Add support for Unicode values (\uxxxx, \Uxxxxxxxx) in contraction tables. (dm)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@3525 91a5dbb7-01b9-0310-9b5f-b28072856b6e

--- Programs/ctb_compile.c
+++ Programs/ctb_compile.c
@@ -416,52 +416,91 @@
           case WC_C('\\'):
             ok = 1;
             break;
+
           case WC_C('f'):
             character = WC_C('\f');
             ok = 1;
             break;
+
           case WC_C('n'):
             character = WC_C('\n');
             ok = 1;
             break;
-          case WC_C('o'):
-            if (length - index > 3) {
-              int high, middle, low;
-              if (octalDigit(data, &high, token[++index]))
-                if (high < 04)
-                  if (octalDigit(data, &middle, token[++index]))
-                    if (octalDigit(data, &low, token[++index])) {
-                      character = (high << 6) | (middle << 3) | low;
-                      ok = 1;
-                    }
-            }
-            break;
+
           case WC_C('r'):
             character = WC_C('\r');
             ok = 1;
             break;
+
           case WC_C('s'):
             character = WC_C(' ');
             ok = 1;
             break;
+
           case WC_C('t'):
             character = WC_C('\t');
             ok = 1;
             break;
+
           case WC_C('v'):
             character = WC_C('\v');
             ok = 1;
             break;
-          case WC_C('x'):
-            if (length - index > 2) {
-              int high, low;
-              if (hexadecimalDigit(data, &high, token[++index]))
-                if (hexadecimalDigit(data, &low, token[++index])) {
-                  character = (high << 4) | low;
-                  ok = 1;
+
+          {
+            int count;
+
+          case WC_C('o'):
+            count = 3;
+
+            if ((length - index) > count) {
+              character = 0;
+              ok = 1;
+
+              do {
+                int octet;
+                if (!octalDigit(data, &octet, token[++index])) {
+                  ok = 0;
+                  break;
                 }
+
+                character = (character << 3) | octet;
+              } while (--count);
             }
             break;
+          }
+
+          {
+            int count;
+
+          case WC_C('U'):
+            count = 8;
+            goto hexadecimal;
+
+          case WC_C('u'):
+            count = 4;
+            goto hexadecimal;
+
+          case WC_C('x'):
+            count = 2;
+          hexadecimal:
+
+            if ((length - index) > count) {
+              character = 0;
+              ok = 1;
+
+              do {
+                int nibble;
+                if (!hexadecimalDigit(data, &nibble, token[++index])) {
+                  ok = 0;
+                  break;
+                }
+
+                character = (character << 4) | nibble;
+              } while (--count);
+            }
+            break;
+          }
         }
       }
       if (!ok) {
@@ -679,8 +718,7 @@
       if (getToken(data, &token, &length, "capital sign"))
         if (parseDots(data, &cells, token, length)) {
           ContractionTableOffset offset;
-          if (!saveSequence(data, &offset, &cells))
-            goto failure;
+          if (!saveSequence(data, &offset, &cells)) goto failure;
           tableHeader->capitalSign = offset;
         }
       break;
@@ -691,8 +729,7 @@
       if (getToken(data, &token, &length, "begin capital sign"))
         if (parseDots(data, &cells, token, length)) {
           ContractionTableOffset offset;
-          if (!saveSequence(data, &offset, &cells))
-            goto failure;
+          if (!saveSequence(data, &offset, &cells)) goto failure;
           tableHeader->beginCapitalSign = offset;
         }
       break;
@@ -703,8 +740,7 @@
       if (getToken(data, &token, &length, "end capital sign"))
         if (parseDots(data, &cells, token, length)) {
           ContractionTableOffset offset;
-          if (!saveSequence(data, &offset, &cells))
-            goto failure;
+          if (!saveSequence(data, &offset, &cells)) goto failure;
           tableHeader->endCapitalSign = offset;
         }
       break;
@@ -715,8 +751,7 @@
       if (getToken(data, &token, &length, "letter sign"))
         if (parseDots(data, &cells, token, length)) {
           ContractionTableOffset offset;
-          if (!saveSequence(data, &offset, &cells))
-            goto failure;
+          if (!saveSequence(data, &offset, &cells)) goto failure;
           tableHeader->englishLetterSign = offset;
         }
       break;
@@ -727,8 +762,7 @@
       if (getToken(data, &token, &length, "number sign"))
         if (parseDots(data, &cells, token, length)) {
           ContractionTableOffset offset;
-          if (!saveSequence(data, &offset, &cells))
-            goto failure;
+          if (!saveSequence(data, &offset, &cells)) goto failure;
           tableHeader->numberSign = offset;
         }
       break;


i2c: Make i2cdev_notifier_call static

i2c: Make i2cdev_notifier_call static

The function i2cdev_notifier_call is used only in i2c-dev file
making it static.
Also removes the following sparse warning

drivers/i2c/i2c-dev.c:582:5: warning: symbol 'i2cdev_notifier_call'
was not declared. Should it be static?

Signed-off-by: Shubhrajyoti D <7810ac0734ae29fb564af1d0a4b317a3aa466f25@ti.com>
Signed-off-by: Jean Delvare <49ad6a9f5aa17024c23048df346d55bda6837e01@linux-fr.org>

--- drivers/i2c/i2c-dev.c
+++ drivers/i2c/i2c-dev.c
@@ -579,7 +579,7 @@
 	return 0;
 }

-int i2cdev_notifier_call(struct notifier_block *nb, unsigned long action,
+static int i2cdev_notifier_call(struct notifier_block *nb, unsigned long action,
 			 void *data)
 {
 	struct device *dev = data;


drivers: i2c: telink_b91: replace Pinmux by Pinctrl

Updated driver to use new Pinctrl driver.

Signed-off-by: Yuriy Vynnychek <a84feaeb1f754105d62c9a6971fe842c95d6cc94@telink-semi.com>

--- drivers/i2c/i2c_b91.c
+++ drivers/i2c/i2c_b91.c
@@ -14,14 +14,12 @@

 #include <drivers/i2c.h>
 #include "i2c-priv.h"
-#include <drivers/pinmux.h>
-#include <dt-bindings/pinctrl/b91-pinctrl.h>
+#include <drivers/pinctrl.h>

 /* I2C configuration structure */
 struct i2c_b91_cfg {
 	uint32_t bitrate;
-	const uint32_t *pinctrl_list;
-	size_t pinctrl_list_size;
+	const struct pinctrl_dev_config *pcfg;
 };

 /* I2C data structure */
@@ -124,7 +122,6 @@
 static int i2c_b91_init(const struct device *dev)
 {
 	int status = 0;
-	const struct device *pinmux;
 	const struct i2c_b91_cfg *cfg = dev->config;
 	struct i2c_b91_data *data = dev->data;
 	uint32_t dev_config = (I2C_MODE_MASTER | i2c_map_dt_bitrate(cfg->bitrate));
@@ -139,16 +136,11 @@
 		return status;
 	}

-	/* get pinmux driver */
-	pinmux = DEVICE_DT_GET(DT_NODELABEL(pinmux));
-	if (!device_is_ready(pinmux)) {
-		return -ENODEV;
-	}
-
-	/* config pins */
-	for (int i = 0; i < cfg->pinctrl_list_size; i++) {
-		pinmux_pin_set(pinmux, B91_PINMUX_GET_PIN(cfg->pinctrl_list[i]),
-			       B91_PINMUX_GET_FUNC(cfg->pinctrl_list[i]));
+	/* configure pins */
+	status = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT);
+	if (status < 0) {
+		LOG_ERR("Failed to configure I2C pins");
+		return status;
 	}

 	return 0;
@@ -164,25 +156,23 @@
 	     "unsupported I2C instance");

 /* I2C driver registration */
-#define I2C_B91_INIT(inst)					  \
-								  \
-	static const uint32_t i2c_pins_##inst[] =		  \
-		B91_PINMUX_DT_INST_GET_ARRAY(inst, 0);		  \
-								  \
-	static struct i2c_b91_data i2c_b91_data_##inst;		  \
-								  \
-	static struct i2c_b91_cfg i2c_b91_cfg_##inst = {	  \
-		.bitrate = DT_INST_PROP(inst, clock_frequency),	  \
-		.pinctrl_list_size = ARRAY_SIZE(i2c_pins_##inst), \
-		.pinctrl_list = i2c_pins_##inst			  \
-	};							  \
-								  \
-	I2C_DEVICE_DT_INST_DEFINE(inst, i2c_b91_init,		  \
-			      NULL,				  \
-			      &i2c_b91_data_##inst,		  \
-			      &i2c_b91_cfg_##inst,		  \
-			      POST_KERNEL,			  \
-			      CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
-			      &i2c_b91_api);
+#define I2C_B91_INIT(inst)					      \
+								      \
+	PINCTRL_DT_INST_DEFINE(inst);				      \
+								      \
+	static struct i2c_b91_data i2c_b91_data_##inst;		      \
+								      \
+	static struct i2c_b91_cfg i2c_b91_cfg_##inst = {	      \
+		.bitrate = DT_INST_PROP(inst, clock_frequency),	      \
+		.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst),	      \
+	};							      \
+								      \
+	I2C_DEVICE_DT_INST_DEFINE(inst, i2c_b91_init,		      \
+				  NULL,				      \
+				  &i2c_b91_data_##inst,		      \
+				  &i2c_b91_cfg_##inst,		      \
+				  POST_KERNEL,			      \
+				  CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
+				  &i2c_b91_api);

 DT_INST_FOREACH_STATUS_OKAY(I2C_B91_INIT)


Unit test: Remove all 'noexcept' specifications

'noexcept' specifications were made without much
thought. Since it is an integral part of the function
interface, it requires more thought before including
it. Therefore remove all noexcept specifications for now.

--- core/ad_ut.h
+++ core/ad_ut.h
@@ -60,7 +60,7 @@
      *
      * Initializes all member variables
      */
-    AssertError() noexcept
+    AssertError()
         : mExp(), mFile(), mLine(-1), mFunc()
     {
     }
@@ -78,7 +78,7 @@
      * fact a macro is used instead of a function for this very reason.
      */
     AssertError(const std::string& exp,
-        const std::string& file, Int line) noexcept
+        const std::string& file, Int line)
         : mExp(exp), mFile(file), mLine(line), mFunc()
     {
     }
@@ -109,7 +109,7 @@
      */
     template <class Func>
     AssertError(const std::string& exp,
-        const std::string& file, Int line, Func&& func) noexcept
+        const std::string& file, Int line, Func&& func)
         :  mExp(exp), mFile(file), mLine(line), mFunc(std::forward<Func>(func))
     {
     }
@@ -117,7 +117,7 @@
     /**
      * @brief   Copy constructor
      */
-    AssertError(const AssertError& assertError) noexcept
+    AssertError(const AssertError& assertError)
         : mExp(assertError.mExp), mFile(assertError.mFile),
         mLine(assertError.mLine), mFunc(assertError.mFunc)
     {
@@ -126,7 +126,7 @@
     /**
      * @brief   Move constructor
      */
-    AssertError(AssertError&& assertError) noexcept
+    AssertError(AssertError&& assertError)
         : mExp(std::move(assertError.mExp)), mFile(std::move(assertError.mFile)),
         mLine(std::move(assertError.mLine)), mFunc(std::move(assertError.mFunc))
     {
@@ -135,7 +135,7 @@
     /**
      * @brief   Destructor
      */
-    ~AssertError() noexcept
+    ~AssertError()
     {
     }

@@ -144,7 +144,7 @@
      *
      * @return  A description of the error
      */
-    const Char* what() const noexcept
+    const Char* what() const
     {
         return mExp.c_str();
     }
@@ -154,7 +154,7 @@
      *
      * @return  The expression in the form of std::string
      */
-    std::string getExp() const noexcept
+    std::string getExp() const
     {
         return mExp;
     }
@@ -164,7 +164,7 @@
      *
      * @return  The file in the form of std::string
      */
-    std::string getFile() const noexcept
+    std::string getFile() const
     {
         return mFile;
     }
@@ -174,7 +174,7 @@
      *
      * @return  The line in the form of an integer
      */
-    Int getLine() const noexcept
+    Int getLine() const
     {
         return mLine;
     }
@@ -184,7 +184,7 @@
      *
      * @return  True if the function is provided and false otherwise
      */
-    Bool hasFunc() const noexcept
+    Bool hasFunc() const
     {
         return static_cast<Bool>(mFunc);
     }
@@ -195,7 +195,7 @@
      * @param[in]   strm    The stream object that should be passed on to
      *                      the error describing function
      */
-    Void callFunc(StreamType& strm) const noexcept
+    Void callFunc(StreamType& strm) const
     {
         mFunc(strm);
     }
@@ -249,7 +249,7 @@
      *
      * Always use this constructor from derived classes
      */
-    UnitTest() noexcept
+    UnitTest()
         : mName(), mExec(0), mStart(),
         mEnd(), mFail(0), mStrm()
     {
@@ -260,19 +260,19 @@
      *
      * A unit test cannot be copied
      */
-    UnitTest(const UnitTest&) noexcept = delete;
+    UnitTest(const UnitTest&) = delete;

     /**
      * @brief   Deleted move constructor
      *
      * A unit test cannot be moved either since it is not necessary
      */
-    UnitTest(UnitTest&&) noexcept = delete;
+    UnitTest(UnitTest&&) = delete;

     /**
      * @brief   Destructor
      */
-    virtual ~UnitTest() noexcept
+    virtual ~UnitTest()
     {
     }

@@ -286,54 +286,54 @@
     virtual Void operator()() = 0;

 private:
-    Void setName(const std::string& name) noexcept
+    Void setName(const std::string& name)
     {
         mName = name;
     }

-    std::string getName() const noexcept
+    std::string getName() const
     {
         return mName;
     }

-    Bool isExecuted() const noexcept
+    Bool isExecuted() const
     {
         return mExec;
     }

-    TimePoint getStart() const noexcept
+    TimePoint getStart() const
     {
         return mStart;
     }

-    TimePoint getEnd() const noexcept
+    TimePoint getEnd() const
     {
         return mEnd;
     }

-    Bool isFailed() const noexcept
+    Bool isFailed() const
     {
         return mFail;
     }

-    std::string getInfo() const noexcept
+    std::string getInfo() const
     {
         return mStrm.str();
     }

-    Void initialize() noexcept
+    Void initialize()
     {
         mExec = mFail = 0;
         mStart = std::chrono::high_resolution_clock::now();
     }

-    Void finish() noexcept
+    Void finish()
     {
         mExec = 1;
         mEnd = std::chrono::high_resolution_clock::now();
     }

-    Void run() noexcept
+    Void run()
     {
         initialize();
         try {
@@ -506,7 +506,7 @@
     /**
      * @brief   Default constructor
      */
-    UTRunner() noexcept
+    UTRunner()
         : mUt()
     {
     }
@@ -514,17 +514,17 @@
     /**
      * @brief   Deleted copy constructor
      */
-    UTRunner(const UTRunner&) noexcept = delete;
+    UTRunner(const UTRunner&) = delete;

     /**
      * @brief   Deleted move constructor
      */
-    UTRunner(UTRunner&&) noexcept = delete;
+    UTRunner(UTRunner&&) = delete;

     /**
      * @brief   Destructor
      */
-    ~UTRunner() noexcept
+    ~UTRunner()
     {
     }

@@ -533,7 +533,7 @@
      *
      * @param   ostrm   The stream to use to standard output
      */
-    static Void setOutputStream(OutputStream& ostrm) noexcept
+    static Void setOutputStream(OutputStream& ostrm)
     {
         getOutputStream() = &ostrm;
     }
@@ -545,7 +545,7 @@
      *
      * This stream contains information on failed unit test cases.
      */
-    static Void setErrorStream(ErrorStream& estrm) noexcept
+    static Void setErrorStream(ErrorStream& estrm)
     {
         getErrorStream() = &estrm;
     }
@@ -562,7 +562,7 @@
      * @param   args    The arguments to pass to this unit test
      */
     template <class UT, class... Args>
-    Void add(const std::string& name, Args&&... args) noexcept
+    Void add(const std::string& name, Args&&... args)
     {
         mUt.push_back(std::make_unique<UT>(std::forward<Args>(args)...));
         mUt.back()->setName(name);
@@ -573,7 +573,7 @@
      *
      * @return  True if all tests passed else false
      */
-    Bool run() noexcept
+    Bool run()
     {
         OutputStream& ostrm = *getOutputStream();
         ErrorStream& estrm = *getErrorStream();
@@ -651,31 +651,31 @@
     }

 private:
-    static OutputStream*& getOutputStream() noexcept
+    static OutputStream*& getOutputStream()
     {
         static OutputStream* ostrm = &std::cout;
         return ostrm;
     }

-    static ErrorStream*& getErrorStream() noexcept
+    static ErrorStream*& getErrorStream()
     {
         static ErrorStream* estrm = &std::cerr;
         return estrm;
     }

-    static StackType& getStack() noexcept
+    static StackType& getStack()
     {
         static StackType utStack;
         return utStack;
     }

-    static Int& getIndent() noexcept
+    static Int& getIndent()
     {
         static Int indent = 0;
         return indent;
     }

-    std::string getFullName(UTConstIter utIter) noexcept
+    std::string getFullName(UTConstIter utIter)
     {
         std::string fullName;
         for (const auto& x : getStack()) {
@@ -685,7 +685,7 @@
         return fullName;
     }

-    static std::ostream& newline(std::ostream& strm) noexcept
+    static std::ostream& newline(std::ostream& strm)
     {
         strm << '\n';
         getIndent() = 0;


ide: remove needless includes from ide-lib.c

Signed-off-by: Bartlomiej Zolnierkiewicz <248de9df611a028e5eceb9d893a2ed6c24c89ef4@gmail.com>

--- drivers/ide/ide-lib.c
+++ drivers/ide/ide-lib.c
@@ -1,25 +1,10 @@
-#include <linux/module.h>
 #include <linux/types.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
-#include <linux/timer.h>
-#include <linux/mm.h>
 #include <linux/interrupt.h>
-#include <linux/major.h>
-#include <linux/errno.h>
-#include <linux/genhd.h>
-#include <linux/blkpg.h>
-#include <linux/slab.h>
-#include <linux/pci.h>
-#include <linux/delay.h>
 #include <linux/hdreg.h>
 #include <linux/ide.h>
 #include <linux/bitops.h>
-
-#include <asm/byteorder.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>

 static const char *udma_str[] =
 	 { "UDMA/16", "UDMA/25",  "UDMA/33",  "UDMA/44",


dm raid1: explicitly initialise bio_lists

Explicitly initialize bio lists instead of relying on kzalloc.

Signed-off-by: Mikulas Patocka <52f8f9962b7f38d8269c63c0859d68147c8d10f0@redhat.com>
Reviewed-by: Takahiro Yasui <46471600d6227cf20f86163991b4ee401f1dc869@redhat.com>
Tested-by: Takahiro Yasui <46471600d6227cf20f86163991b4ee401f1dc869@redhat.com>
Signed-off-by: Alasdair G Kergon <620085386a2c64ec2f1d43bef997c15003f13da2@redhat.com>

--- drivers/md/dm-raid1.c
+++ drivers/md/dm-raid1.c
@@ -849,6 +849,10 @@
 	}

 	spin_lock_init(&ms->lock);
+	bio_list_init(&ms->reads);
+	bio_list_init(&ms->writes);
+	bio_list_init(&ms->failures);
+	bio_list_init(&ms->holds);

 	ms->ti = ti;
 	ms->nr_mirrors = nr_mirrors;


lib8390: Indent braces appropriately

lib8390: Indent braces appropriately

Move the braces around to conform to kernel standard style.

Signed-off-by: Joe Perches <16a9a54ddf4259952e3c118c763138e83693d7fd@perches.com>
Acked-by: Geert Uytterhoeven <0da414d9d963da4039c2a0525b1844228075aa58@linux-m68k.org>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/lib8390.c
+++ drivers/net/lib8390.c
@@ -272,8 +272,7 @@
 		   (isr) ? "lost interrupt?" : "cable problem?",
 		   txsr, isr, tickssofar);

-	if (!isr && !dev->stats.tx_packets)
-	{
+	if (!isr && !dev->stats.tx_packets) {
 		/* The 8390 probably hasn't gotten on the cable yet. */
 		ei_local->interface_num ^= 1;   /* Try a different xcvr.  */
 	}
@@ -345,24 +344,19 @@
 	 * card, leaving a substantial gap between each transmitted packet.
 	 */

-	if (ei_local->tx1 == 0)
-	{
+	if (ei_local->tx1 == 0) {
 		output_page = ei_local->tx_start_page;
 		ei_local->tx1 = send_length;
 		if (ei_debug  &&  ei_local->tx2 > 0)
 			netdev_dbg(dev, "idle transmitter tx2=%d, lasttx=%d, txing=%d\n",
 				   ei_local->tx2, ei_local->lasttx, ei_local->txing);
-	}
-	else if (ei_local->tx2 == 0)
-	{
+	} else if (ei_local->tx2 == 0) {
 		output_page = ei_local->tx_start_page + TX_PAGES/2;
 		ei_local->tx2 = send_length;
 		if (ei_debug  &&  ei_local->tx1 > 0)
 			netdev_dbg(dev, "idle transmitter, tx1=%d, lasttx=%d, txing=%d\n",
 				   ei_local->tx1, ei_local->lasttx, ei_local->txing);
-	}
-	else
-	{	/* We should never get here. */
+	} else {			/* We should never get here. */
 		if (ei_debug)
 			netdev_dbg(dev, "No Tx buffers free! tx1=%d tx2=%d last=%d\n",
 				   ei_local->tx1, ei_local->tx2, ei_local->lasttx);
@@ -383,22 +377,18 @@

 	ei_block_output(dev, send_length, data, output_page);

-	if (! ei_local->txing)
-	{
+	if (! ei_local->txing) {
 		ei_local->txing = 1;
 		NS8390_trigger_send(dev, send_length, output_page);
-		if (output_page == ei_local->tx_start_page)
-		{
+		if (output_page == ei_local->tx_start_page) {
 			ei_local->tx1 = -1;
 			ei_local->lasttx = -1;
-		}
-		else
-		{
+		} else {
 			ei_local->tx2 = -1;
 			ei_local->lasttx = -2;
 		}
-	}
-	else ei_local->txqueue++;
+	} else
+		ei_local->txqueue++;

 	if (ei_local->tx1  &&  ei_local->tx2)
 		netif_stop_queue(dev);
@@ -443,8 +433,7 @@

 	spin_lock(&ei_local->page_lock);

-	if (ei_local->irqlock)
-	{
+	if (ei_local->irqlock) {
 		/*
 		 * This might just be an interrupt for a PCI device sharing
 		 * this line
@@ -464,8 +453,7 @@

 	/* !!Assumption!! -- we stay in page 0.	 Don't break this. */
 	while ((interrupts = ei_inb_p(e8390_base + EN0_ISR)) != 0 &&
-	       ++nr_serviced < MAX_SERVICE)
-	{
+	       ++nr_serviced < MAX_SERVICE) {
 		if (!netif_running(dev)) {
 			netdev_warn(dev, "interrupt from stopped card\n");
 			/* rmk - acknowledge the interrupts */
@@ -475,8 +463,7 @@
 		}
 		if (interrupts & ENISR_OVER)
 			ei_rx_overrun(dev);
-		else if (interrupts & (ENISR_RX+ENISR_RX_ERR))
-		{
+		else if (interrupts & (ENISR_RX+ENISR_RX_ERR)) {
 			/* Got a good (?) packet. */
 			ei_receive(dev);
 		}
@@ -486,8 +473,7 @@
 		else if (interrupts & ENISR_TX_ERR)
 			ei_tx_err(dev);

-		if (interrupts & ENISR_COUNTERS)
-		{
+		if (interrupts & ENISR_COUNTERS) {
 			dev->stats.rx_frame_errors += ei_inb_p(e8390_base + EN0_COUNTER0);
 			dev->stats.rx_crc_errors   += ei_inb_p(e8390_base + EN0_COUNTER1);
 			dev->stats.rx_missed_errors+= ei_inb_p(e8390_base + EN0_COUNTER2);
@@ -496,18 +482,14 @@

 		/* Ignore any RDC interrupts that make it back to here. */
 		if (interrupts & ENISR_RDC)
-		{
 			ei_outb_p(ENISR_RDC, e8390_base + EN0_ISR);
-		}

 		ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
 	}

-	if (interrupts && ei_debug)
-	{
+	if (interrupts && ei_debug) {
 		ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base + E8390_CMD);
-		if (nr_serviced >= MAX_SERVICE)
-		{
+		if (nr_serviced >= MAX_SERVICE) {
 			/* 0xFF is valid for a card removal */
 			if(interrupts!=0xFF)
 				netdev_warn(dev, "Too much work at interrupt, status %#2.2x\n",
@@ -572,8 +554,7 @@

 	if (tx_was_aborted)
 		ei_tx_intr(dev);
-	else
-	{
+	else {
 		dev->stats.tx_errors++;
 		if (txsr & ENTSR_CRS) dev->stats.tx_carrier_errors++;
 		if (txsr & ENTSR_CDH) dev->stats.tx_heartbeat_errors++;
@@ -603,37 +584,31 @@
 	 */
 	ei_local->txqueue--;

-	if (ei_local->tx1 < 0)
-	{
+	if (ei_local->tx1 < 0) {
 		if (ei_local->lasttx != 1 && ei_local->lasttx != -1)
 			pr_err("%s: bogus last_tx_buffer %d, tx1=%d\n",
 			       ei_local->name, ei_local->lasttx, ei_local->tx1);
 		ei_local->tx1 = 0;
-		if (ei_local->tx2 > 0)
-		{
+		if (ei_local->tx2 > 0) {
 			ei_local->txing = 1;
 			NS8390_trigger_send(dev, ei_local->tx2, ei_local->tx_start_page + 6);
 			dev->trans_start = jiffies;
 			ei_local->tx2 = -1,
 			ei_local->lasttx = 2;
-		}
-		else ei_local->lasttx = 20, ei_local->txing = 0;
-	}
-	else if (ei_local->tx2 < 0)
-	{
+		} else
+			ei_local->lasttx = 20, ei_local->txing = 0;
+	} else if (ei_local->tx2 < 0) {
 		if (ei_local->lasttx != 2  &&  ei_local->lasttx != -2)
 			pr_err("%s: bogus last_tx_buffer %d, tx2=%d\n",
 			       ei_local->name, ei_local->lasttx, ei_local->tx2);
 		ei_local->tx2 = 0;
-		if (ei_local->tx1 > 0)
-		{
+		if (ei_local->tx1 > 0) {
 			ei_local->txing = 1;
 			NS8390_trigger_send(dev, ei_local->tx1, ei_local->tx_start_page);
 			dev->trans_start = jiffies;
 			ei_local->tx1 = -1;
 			ei_local->lasttx = 1;
-		}
-		else
+		} else
 			ei_local->lasttx = 10, ei_local->txing = 0;
 	}
 //	else printk(KERN_WARNING "%s: unexpected TX-done interrupt, lasttx=%d.\n",
@@ -644,11 +619,9 @@
 		dev->stats.collisions++;
 	if (status & ENTSR_PTX)
 		dev->stats.tx_packets++;
-	else
-	{
+	else {
 		dev->stats.tx_errors++;
-		if (status & ENTSR_ABT)
-		{
+		if (status & ENTSR_ABT) {
 			dev->stats.tx_aborted_errors++;
 			dev->stats.collisions += 16;
 		}
@@ -682,8 +655,7 @@
 	struct e8390_pkt_hdr rx_frame;
 	int num_rx_pages = ei_local->stop_page-ei_local->rx_start_page;

-	while (++rx_pkt_count < 10)
-	{
+	while (++rx_pkt_count < 10) {
 		int pkt_len, pkt_stat;

 		/* Get the rx page (incoming packet pointer). */
@@ -730,30 +702,24 @@
 			continue;
 		}

-		if (pkt_len < 60  ||  pkt_len > 1518)
-		{
+		if (pkt_len < 60  ||  pkt_len > 1518) {
 			if (ei_debug)
 				netdev_dbg(dev, "bogus packet size: %d, status=%#2x nxpg=%#2x\n",
 					   rx_frame.count, rx_frame.status,
 					   rx_frame.next);
 			dev->stats.rx_errors++;
 			dev->stats.rx_length_errors++;
-		}
-		 else if ((pkt_stat & 0x0F) == ENRSR_RXOK)
-		{
+		} else if ((pkt_stat & 0x0F) == ENRSR_RXOK) {
 			struct sk_buff *skb;

 			skb = dev_alloc_skb(pkt_len+2);
-			if (skb == NULL)
-			{
+			if (skb == NULL) {
 				if (ei_debug > 1)
 					netdev_dbg(dev, "Couldn't allocate a sk_buff of size %d\n",
 						   pkt_len);
 				dev->stats.rx_dropped++;
 				break;
-			}
-			else
-			{
+			} else {
 				skb_reserve(skb,2);	/* IP headers on 16 byte boundaries */
 				skb_put(skb, pkt_len);	/* Make room */
 				ei_block_input(dev, pkt_len, skb, current_offset + sizeof(rx_frame));
@@ -765,9 +731,7 @@
 				if (pkt_stat & ENRSR_PHY)
 					dev->stats.multicast++;
 			}
-		}
-		else
-		{
+		} else {
 			if (ei_debug)
 				netdev_dbg(dev, "bogus packet: status=%#2x nxpg=%#2x size=%d\n",
 					   rx_frame.status, rx_frame.next,
@@ -845,8 +809,7 @@
 	 * step is vital, and skipping it will cause no end of havoc.
 	 */

-	if (was_txing)
-	{
+	if (was_txing) {
 		unsigned char tx_completed = ei_inb_p(e8390_base+EN0_ISR) & (ENISR_TX+ENISR_TX_ERR);
 		if (!tx_completed)
 			must_resend = 1;
@@ -930,13 +893,11 @@
 	int i;
 	struct ei_device *ei_local = netdev_priv(dev);

-	if (!(dev->flags&(IFF_PROMISC|IFF_ALLMULTI)))
-	{
+	if (!(dev->flags&(IFF_PROMISC|IFF_ALLMULTI))) {
 		memset(ei_local->mcfilter, 0, 8);
 		if (!netdev_mc_empty(dev))
 			make_mc_bits(ei_local->mcfilter, dev);
-	}
-	else
+	} else
 		memset(ei_local->mcfilter, 0xFF, 8);	/* mcast set to accept-all */

 	/*
@@ -955,8 +916,7 @@
 	if (netif_running(dev))
 		ei_outb_p(E8390_RXCONFIG, e8390_base + EN0_RXCR);
 	ei_outb_p(E8390_NODMA + E8390_PAGE1, e8390_base + E8390_CMD);
-	for(i = 0; i < 8; i++)
-	{
+	for(i = 0; i < 8; i++) {
 		ei_outb_p(ei_local->mcfilter[i], e8390_base + EN1_MULT_SHIFT(i));
 #ifndef BUG_83C690
 		if(ei_inb_p(e8390_base + EN1_MULT_SHIFT(i))!=ei_local->mcfilter[i])
@@ -1069,8 +1029,7 @@
 	/* Copy the station address into the DS8390 registers. */

 	ei_outb_p(E8390_NODMA + E8390_PAGE1 + E8390_STOP, e8390_base+E8390_CMD); /* 0x61 */
-	for(i = 0; i < 6; i++)
-	{
+	for(i = 0; i < 6; i++) {
 		ei_outb_p(dev->dev_addr[i], e8390_base + EN1_PHYS_SHIFT(i));
 		if (ei_debug > 1 && ei_inb_p(e8390_base + EN1_PHYS_SHIFT(i))!=dev->dev_addr[i])
 			netdev_err(dev, "Hw. address read/write mismap %d\n", i);
@@ -1082,8 +1041,7 @@
 	ei_local->tx1 = ei_local->tx2 = 0;
 	ei_local->txing = 0;

-	if (startp)
-	{
+	if (startp) {
 		ei_outb_p(0xff,  e8390_base + EN0_ISR);
 		ei_outb_p(ENISR_ALL,  e8390_base + EN0_IMR);
 		ei_outb_p(E8390_NODMA+E8390_PAGE0+E8390_START, e8390_base+E8390_CMD);
@@ -1105,8 +1063,7 @@

 	ei_outb_p(E8390_NODMA+E8390_PAGE0, e8390_base+E8390_CMD);

-	if (ei_inb_p(e8390_base + E8390_CMD) & E8390_TRANS)
-	{
+	if (ei_inb_p(e8390_base + E8390_CMD) & E8390_TRANS) {
 		netdev_warn(dev, "trigger_send() called with the transmitter busy\n");
 		return;
 	}


NET: ns83820.c remove fastcall macro

NET: ns83820.c remove fastcall macro

Signed-off-by: Harvey Harrison <eadbd6b462bf3c97df0300a934c12bc2e5d1fe51@gmail.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/net/ns83820.c
+++ drivers/net/ns83820.c
@@ -611,8 +611,7 @@
 	return i ? 0 : -ENOMEM;
 }

-static void rx_refill_atomic(struct net_device *ndev);
-static void fastcall rx_refill_atomic(struct net_device *ndev)
+static void rx_refill_atomic(struct net_device *ndev)
 {
 	rx_refill(ndev, GFP_ATOMIC);
 }
@@ -633,7 +632,7 @@
 	build_rx_desc(dev, dev->rx_info.descs + (DESC_SIZE * i), 0, 0, CMDSTS_OWN, 0);
 }

-static void fastcall phy_intr(struct net_device *ndev)
+static void phy_intr(struct net_device *ndev)
 {
 	struct ns83820 *dev = PRIV(ndev);
 	static const char *speeds[] = { "10", "100", "1000", "1000(?)", "1000F" };
@@ -831,7 +830,7 @@
 	}
 }

-static void fastcall ns83820_rx_kick(struct net_device *ndev)
+static void ns83820_rx_kick(struct net_device *ndev)
 {
 	struct ns83820 *dev = PRIV(ndev);
 	/*if (nr_rx_empty(dev) >= NR_RX_DESC/4)*/ {
@@ -852,7 +851,7 @@
 /* rx_irq
  *
  */
-static void fastcall rx_irq(struct net_device *ndev)
+static void rx_irq(struct net_device *ndev)
 {
 	struct ns83820 *dev = PRIV(ndev);
 	struct rx_info *info = &dev->rx_info;


[PATCH] pcnet32: move/create receive and transmit routines

Move the receive routine and create the transmit routine.

Tested ia32 and ppc64.

Signed-off-by:  Don Fry <c8b40ea5dc39193fc7eeec0975ba9b31ab2b20df@us.ibm.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/net/pcnet32.c
+++ drivers/net/pcnet32.c
@@ -299,7 +299,6 @@
 static int pcnet32_open(struct net_device *);
 static int pcnet32_init_ring(struct net_device *);
 static int pcnet32_start_xmit(struct sk_buff *, struct net_device *);
-static int pcnet32_rx(struct net_device *);
 static void pcnet32_tx_timeout(struct net_device *dev);
 static irqreturn_t pcnet32_interrupt(int, void *, struct pt_regs *);
 static int pcnet32_close(struct net_device *);
@@ -1123,6 +1122,264 @@
 		}
 	}
 	return 1;
+}
+
+
+static int pcnet32_rx(struct net_device *dev)
+{
+	struct pcnet32_private *lp = dev->priv;
+	int entry = lp->cur_rx & lp->rx_mod_mask;
+	int boguscnt = lp->rx_ring_size / 2;
+
+	/* If we own the next entry, it's a new packet. Send it up. */
+	while ((short)le16_to_cpu(lp->rx_ring[entry].status) >= 0) {
+		int status = (short)le16_to_cpu(lp->rx_ring[entry].status) >> 8;
+
+		if (status != 0x03) {	/* There was an error. */
+			/*
+			 * There is a tricky error noted by John Murphy,
+			 * <murf@perftech.com> to Russ Nelson: Even with full-sized
+			 * buffers it's possible for a jabber packet to use two
+			 * buffers, with only the last correctly noting the error.
+			 */
+			if (status & 0x01)	/* Only count a general error at the */
+				lp->stats.rx_errors++;	/* end of a packet. */
+			if (status & 0x20)
+				lp->stats.rx_frame_errors++;
+			if (status & 0x10)
+				lp->stats.rx_over_errors++;
+			if (status & 0x08)
+				lp->stats.rx_crc_errors++;
+			if (status & 0x04)
+				lp->stats.rx_fifo_errors++;
+			lp->rx_ring[entry].status &= le16_to_cpu(0x03ff);
+		} else {
+			/* Malloc up new buffer, compatible with net-2e. */
+			short pkt_len =
+			    (le32_to_cpu(lp->rx_ring[entry].msg_length) & 0xfff)
+			    - 4;
+			struct sk_buff *skb;
+
+			/* Discard oversize frames. */
+			if (unlikely(pkt_len > PKT_BUF_SZ - 2)) {
+				if (netif_msg_drv(lp))
+					printk(KERN_ERR
+					       "%s: Impossible packet size %d!\n",
+					       dev->name, pkt_len);
+				lp->stats.rx_errors++;
+			} else if (pkt_len < 60) {
+				if (netif_msg_rx_err(lp))
+					printk(KERN_ERR "%s: Runt packet!\n",
+					       dev->name);
+				lp->stats.rx_errors++;
+			} else {
+				int rx_in_place = 0;
+
+				if (pkt_len > rx_copybreak) {
+					struct sk_buff *newskb;
+
+					if ((newskb =
+					     dev_alloc_skb(PKT_BUF_SZ))) {
+						skb_reserve(newskb, 2);
+						skb = lp->rx_skbuff[entry];
+						pci_unmap_single(lp->pci_dev,
+								 lp->
+								 rx_dma_addr
+								 [entry],
+								 PKT_BUF_SZ - 2,
+								 PCI_DMA_FROMDEVICE);
+						skb_put(skb, pkt_len);
+						lp->rx_skbuff[entry] = newskb;
+						newskb->dev = dev;
+						lp->rx_dma_addr[entry] =
+						    pci_map_single(lp->pci_dev,
+								   newskb->data,
+								   PKT_BUF_SZ -
+								   2,
+								   PCI_DMA_FROMDEVICE);
+						lp->rx_ring[entry].base =
+						    le32_to_cpu(lp->
+								rx_dma_addr
+								[entry]);
+						rx_in_place = 1;
+					} else
+						skb = NULL;
+				} else {
+					skb = dev_alloc_skb(pkt_len + 2);
+				}
+
+				if (skb == NULL) {
+					int i;
+					if (netif_msg_drv(lp))
+						printk(KERN_ERR
+						       "%s: Memory squeeze, deferring packet.\n",
+						       dev->name);
+					for (i = 0; i < lp->rx_ring_size; i++)
+						if ((short)
+						    le16_to_cpu(lp->
+								rx_ring[(entry +
+									 i)
+									& lp->
+									rx_mod_mask].
+								status) < 0)
+							break;
+
+					if (i > lp->rx_ring_size - 2) {
+						lp->stats.rx_dropped++;
+						lp->rx_ring[entry].status |=
+						    le16_to_cpu(0x8000);
+						wmb();	/* Make sure adapter sees owner change */
+						lp->cur_rx++;
+					}
+					break;
+				}
+				skb->dev = dev;
+				if (!rx_in_place) {
+					skb_reserve(skb, 2);	/* 16 byte align */
+					skb_put(skb, pkt_len);	/* Make room */
+					pci_dma_sync_single_for_cpu(lp->pci_dev,
+								    lp->
+								    rx_dma_addr
+								    [entry],
+								    PKT_BUF_SZ -
+								    2,
+								    PCI_DMA_FROMDEVICE);
+					eth_copy_and_sum(skb,
+							 (unsigned char *)(lp->
+									   rx_skbuff
+									   [entry]->
+									   data),
+							 pkt_len, 0);
+					pci_dma_sync_single_for_device(lp->
+								       pci_dev,
+								       lp->
+								       rx_dma_addr
+								       [entry],
+								       PKT_BUF_SZ
+								       - 2,
+								       PCI_DMA_FROMDEVICE);
+				}
+				lp->stats.rx_bytes += skb->len;
+				skb->protocol = eth_type_trans(skb, dev);
+				netif_rx(skb);
+				dev->last_rx = jiffies;
+				lp->stats.rx_packets++;
+			}
+		}
+		/*
+		 * The docs say that the buffer length isn't touched, but Andrew Boyd
+		 * of QNX reports that some revs of the 79C965 clear it.
+		 */
+		lp->rx_ring[entry].buf_length = le16_to_cpu(2 - PKT_BUF_SZ);
+		wmb();		/* Make sure owner changes after all others are visible */
+		lp->rx_ring[entry].status |= le16_to_cpu(0x8000);
+		entry = (++lp->cur_rx) & lp->rx_mod_mask;
+		if (--boguscnt <= 0)
+			break;	/* don't stay in loop forever */
+	}
+
+	return 0;
+}
+
+static int pcnet32_tx(struct net_device *dev, u16 csr0)
+{
+	struct pcnet32_private *lp = dev->priv;
+	unsigned int dirty_tx = lp->dirty_tx;
+	int delta;
+	int must_restart = 0;
+
+	while (dirty_tx != lp->cur_tx) {
+		int entry = dirty_tx & lp->tx_mod_mask;
+		int status = (short)le16_to_cpu(lp->tx_ring[entry].status);
+
+		if (status < 0)
+			break;	/* It still hasn't been Txed */
+
+		lp->tx_ring[entry].base = 0;
+
+		if (status & 0x4000) {
+			/* There was an major error, log it. */
+			int err_status = le32_to_cpu(lp->tx_ring[entry].misc);
+			lp->stats.tx_errors++;
+			if (netif_msg_tx_err(lp))
+				printk(KERN_ERR
+				       "%s: Tx error status=%04x err_status=%08x\n",
+				       dev->name, status,
+				       err_status);
+			if (err_status & 0x04000000)
+				lp->stats.tx_aborted_errors++;
+			if (err_status & 0x08000000)
+				lp->stats.tx_carrier_errors++;
+			if (err_status & 0x10000000)
+				lp->stats.tx_window_errors++;
+#ifndef DO_DXSUFLO
+			if (err_status & 0x40000000) {
+				lp->stats.tx_fifo_errors++;
+				/* Ackk!  On FIFO errors the Tx unit is turned off! */
+				/* Remove this verbosity later! */
+				if (netif_msg_tx_err(lp))
+					printk(KERN_ERR
+					       "%s: Tx FIFO error! CSR0=%4.4x\n",
+					       dev->name, csr0);
+				must_restart = 1;
+			}
+#else
+			if (err_status & 0x40000000) {
+				lp->stats.tx_fifo_errors++;
+				if (!lp->dxsuflo) {	/* If controller doesn't recover ... */
+					/* Ackk!  On FIFO errors the Tx unit is turned off! */
+					/* Remove this verbosity later! */
+					if (netif_msg_tx_err
+					    (lp))
+						printk(KERN_ERR
+						       "%s: Tx FIFO error! CSR0=%4.4x\n",
+						       dev->name, csr0);
+					must_restart = 1;
+				}
+			}
+#endif
+		} else {
+			if (status & 0x1800)
+				lp->stats.collisions++;
+			lp->stats.tx_packets++;
+		}
+
+		/* We must free the original skb */
+		if (lp->tx_skbuff[entry]) {
+			pci_unmap_single(lp->pci_dev,
+					 lp->tx_dma_addr[entry],
+					 lp->tx_skbuff[entry]->
+					 len, PCI_DMA_TODEVICE);
+			dev_kfree_skb_irq(lp->tx_skbuff[entry]);
+			lp->tx_skbuff[entry] = NULL;
+			lp->tx_dma_addr[entry] = 0;
+		}
+		dirty_tx++;
+	}
+
+	delta =
+	    (lp->cur_tx - dirty_tx) & (lp->tx_mod_mask +
+				       lp->tx_ring_size);
+	if (delta > lp->tx_ring_size) {
+		if (netif_msg_drv(lp))
+			printk(KERN_ERR
+			       "%s: out-of-sync dirty pointer, %d vs. %d, full=%d.\n",
+			       dev->name, dirty_tx, lp->cur_tx,
+			       lp->tx_full);
+		dirty_tx += lp->tx_ring_size;
+		delta -= lp->tx_ring_size;
+	}
+
+	if (lp->tx_full &&
+	    netif_queue_stopped(dev) &&
+	    delta < lp->tx_ring_size - 2) {
+		/* The ring is no longer full, clear tbusy. */
+		lp->tx_full = 0;
+		netif_wake_queue(dev);
+	}
+	lp->dirty_tx = dirty_tx;
+
+	return must_restart;
 }

 #define PCNET32_REGS_PER_PHY	32
@@ -2296,105 +2553,7 @@
 			pcnet32_rx(dev);

 		if (csr0 & 0x0200) {	/* Tx-done interrupt */
-			unsigned int dirty_tx = lp->dirty_tx;
-			int delta;
-
-			while (dirty_tx != lp->cur_tx) {
-				int entry = dirty_tx & lp->tx_mod_mask;
-				int status =
-				    (short)le16_to_cpu(lp->tx_ring[entry].
-						       status);
-
-				if (status < 0)
-					break;	/* It still hasn't been Txed */
-
-				lp->tx_ring[entry].base = 0;
-
-				if (status & 0x4000) {
-					/* There was an major error, log it. */
-					int err_status =
-					    le32_to_cpu(lp->tx_ring[entry].
-							misc);
-					lp->stats.tx_errors++;
-					if (netif_msg_tx_err(lp))
-						printk(KERN_ERR
-						       "%s: Tx error status=%04x err_status=%08x\n",
-						       dev->name, status,
-						       err_status);
-					if (err_status & 0x04000000)
-						lp->stats.tx_aborted_errors++;
-					if (err_status & 0x08000000)
-						lp->stats.tx_carrier_errors++;
-					if (err_status & 0x10000000)
-						lp->stats.tx_window_errors++;
-#ifndef DO_DXSUFLO
-					if (err_status & 0x40000000) {
-						lp->stats.tx_fifo_errors++;
-						/* Ackk!  On FIFO errors the Tx unit is turned off! */
-						/* Remove this verbosity later! */
-						if (netif_msg_tx_err(lp))
-							printk(KERN_ERR
-							       "%s: Tx FIFO error! CSR0=%4.4x\n",
-							       dev->name, csr0);
-						must_restart = 1;
-					}
-#else
-					if (err_status & 0x40000000) {
-						lp->stats.tx_fifo_errors++;
-						if (!lp->dxsuflo) {	/* If controller doesn't recover ... */
-							/* Ackk!  On FIFO errors the Tx unit is turned off! */
-							/* Remove this verbosity later! */
-							if (netif_msg_tx_err
-							    (lp))
-								printk(KERN_ERR
-								       "%s: Tx FIFO error! CSR0=%4.4x\n",
-								       dev->
-								       name,
-								       csr0);
-							must_restart = 1;
-						}
-					}
-#endif
-				} else {
-					if (status & 0x1800)
-						lp->stats.collisions++;
-					lp->stats.tx_packets++;
-				}
-
-				/* We must free the original skb */
-				if (lp->tx_skbuff[entry]) {
-					pci_unmap_single(lp->pci_dev,
-							 lp->tx_dma_addr[entry],
-							 lp->tx_skbuff[entry]->
-							 len, PCI_DMA_TODEVICE);
-					dev_kfree_skb_irq(lp->tx_skbuff[entry]);
-					lp->tx_skbuff[entry] = NULL;
-					lp->tx_dma_addr[entry] = 0;
-				}
-				dirty_tx++;
-			}
-
-			delta =
-			    (lp->cur_tx - dirty_tx) & (lp->tx_mod_mask +
-						       lp->tx_ring_size);
-			if (delta > lp->tx_ring_size) {
-				if (netif_msg_drv(lp))
-					printk(KERN_ERR
-					       "%s: out-of-sync dirty pointer, %d vs. %d, full=%d.\n",
-					       dev->name, dirty_tx, lp->cur_tx,
-					       lp->tx_full);
-				dirty_tx += lp->tx_ring_size;
-				delta -= lp->tx_ring_size;
-			}
-
-			if (lp->tx_full &&
-			    netif_queue_stopped(dev) &&
-			    delta < lp->tx_ring_size - 2) {
-				/* The ring is no longer full, clear tbusy. */
-				lp->tx_full = 0;
-				netif_wake_queue(dev);
-			}
-			lp->dirty_tx = dirty_tx;
+			must_restart = pcnet32_tx(dev, csr0);
 		}

 		/* Log misc errors. */
@@ -2441,162 +2600,6 @@
 	spin_unlock(&lp->lock);

 	return IRQ_HANDLED;
-}
-
-static int pcnet32_rx(struct net_device *dev)
-{
-	struct pcnet32_private *lp = dev->priv;
-	int entry = lp->cur_rx & lp->rx_mod_mask;
-	int boguscnt = lp->rx_ring_size / 2;
-
-	/* If we own the next entry, it's a new packet. Send it up. */
-	while ((short)le16_to_cpu(lp->rx_ring[entry].status) >= 0) {
-		int status = (short)le16_to_cpu(lp->rx_ring[entry].status) >> 8;
-
-		if (status != 0x03) {	/* There was an error. */
-			/*
-			 * There is a tricky error noted by John Murphy,
-			 * <murf@perftech.com> to Russ Nelson: Even with full-sized
-			 * buffers it's possible for a jabber packet to use two
-			 * buffers, with only the last correctly noting the error.
-			 */
-			if (status & 0x01)	/* Only count a general error at the */
-				lp->stats.rx_errors++;	/* end of a packet. */
-			if (status & 0x20)
-				lp->stats.rx_frame_errors++;
-			if (status & 0x10)
-				lp->stats.rx_over_errors++;
-			if (status & 0x08)
-				lp->stats.rx_crc_errors++;
-			if (status & 0x04)
-				lp->stats.rx_fifo_errors++;
-			lp->rx_ring[entry].status &= le16_to_cpu(0x03ff);
-		} else {
-			/* Malloc up new buffer, compatible with net-2e. */
-			short pkt_len =
-			    (le32_to_cpu(lp->rx_ring[entry].msg_length) & 0xfff)
-			    - 4;
-			struct sk_buff *skb;
-
-			/* Discard oversize frames. */
-			if (unlikely(pkt_len > PKT_BUF_SZ - 2)) {
-				if (netif_msg_drv(lp))
-					printk(KERN_ERR
-					       "%s: Impossible packet size %d!\n",
-					       dev->name, pkt_len);
-				lp->stats.rx_errors++;
-			} else if (pkt_len < 60) {
-				if (netif_msg_rx_err(lp))
-					printk(KERN_ERR "%s: Runt packet!\n",
-					       dev->name);
-				lp->stats.rx_errors++;
-			} else {
-				int rx_in_place = 0;
-
-				if (pkt_len > rx_copybreak) {
-					struct sk_buff *newskb;
-
-					if ((newskb =
-					     dev_alloc_skb(PKT_BUF_SZ))) {
-						skb_reserve(newskb, 2);
-						skb = lp->rx_skbuff[entry];
-						pci_unmap_single(lp->pci_dev,
-								 lp->
-								 rx_dma_addr
-								 [entry],
-								 PKT_BUF_SZ - 2,
-								 PCI_DMA_FROMDEVICE);
-						skb_put(skb, pkt_len);
-						lp->rx_skbuff[entry] = newskb;
-						newskb->dev = dev;
-						lp->rx_dma_addr[entry] =
-						    pci_map_single(lp->pci_dev,
-								   newskb->data,
-								   PKT_BUF_SZ -
-								   2,
-								   PCI_DMA_FROMDEVICE);
-						lp->rx_ring[entry].base =
-						    le32_to_cpu(lp->
-								rx_dma_addr
-								[entry]);
-						rx_in_place = 1;
-					} else
-						skb = NULL;
-				} else {
-					skb = dev_alloc_skb(pkt_len + 2);
-				}
-
-				if (skb == NULL) {
-					int i;
-					if (netif_msg_drv(lp))
-						printk(KERN_ERR
-						       "%s: Memory squeeze, deferring packet.\n",
-						       dev->name);
-					for (i = 0; i < lp->rx_ring_size; i++)
-						if ((short)
-						    le16_to_cpu(lp->
-								rx_ring[(entry +
-									 i)
-									& lp->
-									rx_mod_mask].
-								status) < 0)
-							break;
-
-					if (i > lp->rx_ring_size - 2) {
-						lp->stats.rx_dropped++;
-						lp->rx_ring[entry].status |=
-						    le16_to_cpu(0x8000);
-						wmb();	/* Make sure adapter sees owner change */
-						lp->cur_rx++;
-					}
-					break;
-				}
-				skb->dev = dev;
-				if (!rx_in_place) {
-					skb_reserve(skb, 2);	/* 16 byte align */
-					skb_put(skb, pkt_len);	/* Make room */
-					pci_dma_sync_single_for_cpu(lp->pci_dev,
-								    lp->
-								    rx_dma_addr
-								    [entry],
-								    PKT_BUF_SZ -
-								    2,
-								    PCI_DMA_FROMDEVICE);
-					eth_copy_and_sum(skb,
-							 (unsigned char *)(lp->
-									   rx_skbuff
-									   [entry]->
-									   data),
-							 pkt_len, 0);
-					pci_dma_sync_single_for_device(lp->
-								       pci_dev,
-								       lp->
-								       rx_dma_addr
-								       [entry],
-								       PKT_BUF_SZ
-								       - 2,
-								       PCI_DMA_FROMDEVICE);
-				}
-				lp->stats.rx_bytes += skb->len;
-				skb->protocol = eth_type_trans(skb, dev);
-				netif_rx(skb);
-				dev->last_rx = jiffies;
-				lp->stats.rx_packets++;
-			}
-		}
-		/*
-		 * The docs say that the buffer length isn't touched, but Andrew Boyd
-		 * of QNX reports that some revs of the 79C965 clear it.
-		 */
-		lp->rx_ring[entry].buf_length = le16_to_cpu(2 - PKT_BUF_SZ);
-		wmb();		/* Make sure owner changes after all others are visible */
-		lp->rx_ring[entry].status |= le16_to_cpu(0x8000);
-		entry = (++lp->cur_rx) & lp->rx_mod_mask;
-		if (--boguscnt <= 0)
-			break;	/* don't stay in loop forever */
-	}
-
-	return 0;
 }

 static int pcnet32_close(struct net_device *dev)


fix:lualib-src/lua-socket.c:17:19: fatal error: netdb.h: No such file or directory

error: pathspec 'platform/netdb.h' did not match any file(s) known to git

--- platform/netdb.h
+++ platform/netdb.h
@@ -0,0 +1 @@
+#pragma once


[SC92031]: Fix priv->lock context

[SC92031]: Fix priv->lock context

The spin_lock calls made in dev->open and dev->close must disable
BH since open/close are made in process context.  Conversely, the
call in dev->hard_start_xmit does not need to disable BH since it
is already executing with BH disabled.

Signed-off-by: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/sc92031.c
+++ drivers/net/sc92031.c
@@ -964,7 +964,7 @@
 		goto out;
 	}

-	spin_lock_bh(&priv->lock);
+	spin_lock(&priv->lock);

 	if (unlikely(!netif_carrier_ok(dev))) {
 		err = -ENOLINK;
@@ -1005,7 +1005,7 @@
 		netif_stop_queue(dev);

 out_unlock:
-	spin_unlock_bh(&priv->lock);
+	spin_unlock(&priv->lock);

 out:
 	dev_kfree_skb(skb);
@@ -1042,12 +1042,12 @@
 	priv->pm_config = 0;

 	/* Interrupts already disabled by sc92031_stop or sc92031_probe */
-	spin_lock(&priv->lock);
+	spin_lock_bh(&priv->lock);

 	_sc92031_reset(dev);
 	mmiowb();

-	spin_unlock(&priv->lock);
+	spin_unlock_bh(&priv->lock);
 	sc92031_enable_interrupts(dev);

 	if (netif_carrier_ok(dev))
@@ -1077,13 +1077,13 @@
 	/* Disable interrupts, stop Tx and Rx. */
 	sc92031_disable_interrupts(dev);

-	spin_lock(&priv->lock);
+	spin_lock_bh(&priv->lock);

 	_sc92031_disable_tx_rx(dev);
 	_sc92031_tx_clear(dev);
 	mmiowb();

-	spin_unlock(&priv->lock);
+	spin_unlock_bh(&priv->lock);

 	free_irq(pdev->irq, dev);
 	pci_free_consistent(pdev, TX_BUF_TOT_LEN, priv->tx_bufs,
@@ -1539,13 +1539,13 @@
 	/* Disable interrupts, stop Tx and Rx. */
 	sc92031_disable_interrupts(dev);

-	spin_lock(&priv->lock);
+	spin_lock_bh(&priv->lock);

 	_sc92031_disable_tx_rx(dev);
 	_sc92031_tx_clear(dev);
 	mmiowb();

-	spin_unlock(&priv->lock);
+	spin_unlock_bh(&priv->lock);

 out:
 	pci_set_power_state(pdev, pci_choose_state(pdev, state));
@@ -1565,12 +1565,12 @@
 		goto out;

 	/* Interrupts already disabled by sc92031_suspend */
-	spin_lock(&priv->lock);
+	spin_lock_bh(&priv->lock);

 	_sc92031_reset(dev);
 	mmiowb();

-	spin_unlock(&priv->lock);
+	spin_unlock_bh(&priv->lock);
 	sc92031_enable_interrupts(dev);

 	netif_device_attach(dev);


dt/device: Fix auxdata matching to handle entries without a name override

There is no requirement to override name entries in auxdata.  Fix the
entry matching to use .compatible instead of .name to find the end of the
list.

Signed-off-by: Grant Likely <9069e6f5a2b566e2674a0ba1e2bf39c12c195fad@secretlab.ca>

--- drivers/of/platform.c
+++ drivers/of/platform.c
@@ -314,7 +314,7 @@
 	if (!lookup)
 		return NULL;

-	for(; lookup->name != NULL; lookup++) {
+	for(; lookup->compatible != NULL; lookup++) {
 		if (!of_device_is_compatible(np, lookup->compatible))
 			continue;
 		if (of_address_to_resource(np, 0, &res))


Empty local array test

Empty local array test

error: pathspec 'test2/initialisation/array/invalid.c' did not match any file(s) known to git

--- test2/initialisation/array/invalid.c
+++ test2/initialisation/array/invalid.c
@@ -0,0 +1,6 @@
+// RUN: %check -e %s
+
+f()
+{
+	char invalid[]; // CHECK: /error: array has an incomplete size/
+}


drivers/rtc/rtc-s5m.c: fix info->rtc assignment

Fix this warning:

  drivers/rtc/rtc-s5m.c: In function `s5m_rtc_probe':
  drivers/rtc/rtc-s5m.c:545: warning: assignment from incompatible pointer type

struct s5m_rtc_info.rtc has type "struct regmap *", while
struct sec_pmic_dev.rtc has type "struct i2c_client *".

Probably the author wanted to assign "struct sec_pmic_dev.regmap", which
has the correct type.

Also, as "rtc" doesn't make much sense as a name for a regmap, rename it
to "regmap".

Signed-off-by: Geert Uytterhoeven <0da414d9d963da4039c2a0525b1844228075aa58@linux-m68k.org>
Cc: Sangbeom Kim <8f8c58bd4462a0bbd2070cd6f3da233ca14a58a9@samsung.com>
Cc: Sachin Kamat <1c3b1584a6008857f36c03c58f657c0fc16fc09e@linaro.org>
Tested-by: Krzysztof Kozlowski <1a8531307367602b8284517edb33d53d54e5ce8e@samsung.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/rtc/rtc-s5m.c
+++ drivers/rtc/rtc-s5m.c
@@ -31,7 +31,7 @@
 struct s5m_rtc_info {
 	struct device *dev;
 	struct sec_pmic_dev *s5m87xx;
-	struct regmap *rtc;
+	struct regmap *regmap;
 	struct rtc_device *rtc_dev;
 	int irq;
 	int device_type;
@@ -89,7 +89,7 @@
 	int ret;
 	unsigned int data;

-	ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data);
+	ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data);
 	if (ret < 0) {
 		dev_err(info->dev, "failed to read update reg(%d)\n", ret);
 		return ret;
@@ -98,14 +98,14 @@
 	data |= RTC_TIME_EN_MASK;
 	data |= RTC_UDR_MASK;

-	ret = regmap_write(info->rtc, SEC_RTC_UDR_CON, data);
+	ret = regmap_write(info->regmap, SEC_RTC_UDR_CON, data);
 	if (ret < 0) {
 		dev_err(info->dev, "failed to write update reg(%d)\n", ret);
 		return ret;
 	}

 	do {
-		ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data);
+		ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data);
 	} while ((data & RTC_UDR_MASK) && !ret);

 	return ret;
@@ -116,7 +116,7 @@
 	int ret;
 	unsigned int data;

-	ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data);
+	ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data);
 	if (ret < 0) {
 		dev_err(info->dev, "%s: fail to read update reg(%d)\n",
 			__func__, ret);
@@ -126,7 +126,7 @@
 	data &= ~RTC_TIME_EN_MASK;
 	data |= RTC_UDR_MASK;

-	ret = regmap_write(info->rtc, SEC_RTC_UDR_CON, data);
+	ret = regmap_write(info->regmap, SEC_RTC_UDR_CON, data);
 	if (ret < 0) {
 		dev_err(info->dev, "%s: fail to write update reg(%d)\n",
 			__func__, ret);
@@ -134,7 +134,7 @@
 	}

 	do {
-		ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &data);
+		ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &data);
 	} while ((data & RTC_UDR_MASK) && !ret);

 	return ret;
@@ -178,7 +178,7 @@
 	u8 data[8];
 	int ret;

-	ret = regmap_bulk_read(info->rtc, SEC_RTC_SEC, data, 8);
+	ret = regmap_bulk_read(info->regmap, SEC_RTC_SEC, data, 8);
 	if (ret < 0)
 		return ret;

@@ -226,7 +226,7 @@
 		1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday,
 		tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_wday);

-	ret = regmap_raw_write(info->rtc, SEC_RTC_SEC, data, 8);
+	ret = regmap_raw_write(info->regmap, SEC_RTC_SEC, data, 8);
 	if (ret < 0)
 		return ret;

@@ -242,20 +242,20 @@
 	unsigned int val;
 	int ret, i;

-	ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8);
+	ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8);
 	if (ret < 0)
 		return ret;

 	switch (info->device_type) {
 	case S5M8763X:
 		s5m8763_data_to_tm(data, &alrm->time);
-		ret = regmap_read(info->rtc, SEC_ALARM0_CONF, &val);
+		ret = regmap_read(info->regmap, SEC_ALARM0_CONF, &val);
 		if (ret < 0)
 			return ret;

 		alrm->enabled = !!val;

-		ret = regmap_read(info->rtc, SEC_RTC_STATUS, &val);
+		ret = regmap_read(info->regmap, SEC_RTC_STATUS, &val);
 		if (ret < 0)
 			return ret;

@@ -278,7 +278,7 @@
 		}

 		alrm->pending = 0;
-		ret = regmap_read(info->rtc, SEC_RTC_STATUS, &val);
+		ret = regmap_read(info->regmap, SEC_RTC_STATUS, &val);
 		if (ret < 0)
 			return ret;
 		break;
@@ -301,7 +301,7 @@
 	int ret, i;
 	struct rtc_time tm;

-	ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8);
+	ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8);
 	if (ret < 0)
 		return ret;

@@ -312,14 +312,14 @@

 	switch (info->device_type) {
 	case S5M8763X:
-		ret = regmap_write(info->rtc, SEC_ALARM0_CONF, 0);
+		ret = regmap_write(info->regmap, SEC_ALARM0_CONF, 0);
 		break;

 	case S5M8767X:
 		for (i = 0; i < 7; i++)
 			data[i] &= ~ALARM_ENABLE_MASK;

-		ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8);
+		ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8);
 		if (ret < 0)
 			return ret;

@@ -341,7 +341,7 @@
 	u8 alarm0_conf;
 	struct rtc_time tm;

-	ret = regmap_bulk_read(info->rtc, SEC_ALARM0_SEC, data, 8);
+	ret = regmap_bulk_read(info->regmap, SEC_ALARM0_SEC, data, 8);
 	if (ret < 0)
 		return ret;

@@ -353,7 +353,7 @@
 	switch (info->device_type) {
 	case S5M8763X:
 		alarm0_conf = 0x77;
-		ret = regmap_write(info->rtc, SEC_ALARM0_CONF, alarm0_conf);
+		ret = regmap_write(info->regmap, SEC_ALARM0_CONF, alarm0_conf);
 		break;

 	case S5M8767X:
@@ -368,7 +368,7 @@
 		if (data[RTC_YEAR1] & 0x7f)
 			data[RTC_YEAR1] |= ALARM_ENABLE_MASK;

-		ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8);
+		ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8);
 		if (ret < 0)
 			return ret;
 		ret = s5m8767_rtc_set_alarm_reg(info);
@@ -410,7 +410,7 @@
 	if (ret < 0)
 		return ret;

-	ret = regmap_raw_write(info->rtc, SEC_ALARM0_SEC, data, 8);
+	ret = regmap_raw_write(info->regmap, SEC_ALARM0_SEC, data, 8);
 	if (ret < 0)
 		return ret;

@@ -455,7 +455,7 @@
 static void s5m_rtc_enable_wtsr(struct s5m_rtc_info *info, bool enable)
 {
 	int ret;
-	ret = regmap_update_bits(info->rtc, SEC_WTSR_SMPL_CNTL,
+	ret = regmap_update_bits(info->regmap, SEC_WTSR_SMPL_CNTL,
 				 WTSR_ENABLE_MASK,
 				 enable ? WTSR_ENABLE_MASK : 0);
 	if (ret < 0)
@@ -466,7 +466,7 @@
 static void s5m_rtc_enable_smpl(struct s5m_rtc_info *info, bool enable)
 {
 	int ret;
-	ret = regmap_update_bits(info->rtc, SEC_WTSR_SMPL_CNTL,
+	ret = regmap_update_bits(info->regmap, SEC_WTSR_SMPL_CNTL,
 				 SMPL_ENABLE_MASK,
 				 enable ? SMPL_ENABLE_MASK : 0);
 	if (ret < 0)
@@ -481,7 +481,7 @@
 	int ret;
 	struct rtc_time tm;

-	ret = regmap_read(info->rtc, SEC_RTC_UDR_CON, &tp_read);
+	ret = regmap_read(info->regmap, SEC_RTC_UDR_CON, &tp_read);
 	if (ret < 0) {
 		dev_err(info->dev, "%s: fail to read control reg(%d)\n",
 			__func__, ret);
@@ -493,7 +493,7 @@
 	data[1] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT);

 	info->rtc_24hr_mode = 1;
-	ret = regmap_raw_write(info->rtc, SEC_ALARM0_CONF, data, 2);
+	ret = regmap_raw_write(info->regmap, SEC_ALARM0_CONF, data, 2);
 	if (ret < 0) {
 		dev_err(info->dev, "%s: fail to write controlm reg(%d)\n",
 			__func__, ret);
@@ -515,7 +515,7 @@
 		ret = s5m_rtc_set_time(info->dev, &tm);
 	}

-	ret = regmap_update_bits(info->rtc, SEC_RTC_UDR_CON,
+	ret = regmap_update_bits(info->regmap, SEC_RTC_UDR_CON,
 				 RTC_TCON_MASK, tp_read | RTC_TCON_MASK);
 	if (ret < 0)
 		dev_err(info->dev, "%s: fail to update TCON reg(%d)\n",
@@ -542,7 +542,7 @@

 	info->dev = &pdev->dev;
 	info->s5m87xx = s5m87xx;
-	info->rtc = s5m87xx->rtc;
+	info->regmap = s5m87xx->regmap;
 	info->device_type = s5m87xx->device_type;
 	info->wtsr_smpl = s5m87xx->wtsr_smpl;

@@ -596,7 +596,7 @@
 	if (info->wtsr_smpl) {
 		for (i = 0; i < 3; i++) {
 			s5m_rtc_enable_wtsr(info, false);
-			regmap_read(info->rtc, SEC_WTSR_SMPL_CNTL, &val);
+			regmap_read(info->regmap, SEC_WTSR_SMPL_CNTL, &val);
 			pr_debug("%s: WTSR_SMPL reg(0x%02x)\n", __func__, val);
 			if (val & WTSR_ENABLE_MASK)
 				pr_emerg("%s: fail to disable WTSR\n",


drivers: spi_k64: Fix compile error when syslog is enabled

Fixes following error:
...
drivers/spi/spi_k64.c:717:86: error: 'cnt' undeclared (first use in
this function)
...

Change-Id: If49fa4838265cd39a6f72eb265388ff7faae9a9e
Signed-off-by: Andrei Emeltchenko <a6565233ddc88e4fb9c66c1d70743223493f2ed4@intel.com>

--- drivers/spi/spi_k64.c
+++ drivers/spi/spi_k64.c
@@ -714,8 +714,9 @@

 	} while (sys_read32(info->regs + SPI_K64_REG_SR) & SPI_K64_SR_TFFF);

+#ifdef CONFIG_SPI_DEBUG
 	SYS_LOG_DBG("pushed: %d\n", cnt);
-
+#endif
 }

 /**
@@ -776,7 +777,9 @@
 	} while (sys_read32(info->regs + SPI_K64_REG_SR) & SPI_K64_SR_RFDF);

+#ifdef CONFIG_SPI_DEBUG
 	SYS_LOG_DBG("pulled: %d\n", cnt);
+#endif
 }

 /**


make swfplay open normal files again and not require complete URLs

--- player/swfplay.c
+++ player/swfplay.c
@@ -64,6 +64,26 @@
   g_print ("%s\n", message);
 }

+static char *
+sanitize_url (const char *s)
+{
+  SwfdecURL *url;
+
+  url = swfdec_url_new (s);
+  if (g_str_equal (swfdec_url_get_protocol (url), "error")) {
+    char *dir, *full;
+    if (g_path_is_absolute (s))
+      return g_strconcat ("file://", s, NULL);
+    dir = g_get_current_dir ();
+    full = g_strconcat ("file://", dir, G_DIR_SEPARATOR_S, s, NULL);
+    g_free (dir);
+    return full;
+  } else {
+    swfdec_url_free (url);
+    return g_strdup (s);
+  }
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -75,6 +95,7 @@
   gboolean use_image = FALSE, no_sound = FALSE;
   gboolean trace = FALSE;
   char *variables = NULL;
+  char *s;
   GtkWidget *window;

   GOptionEntry options[] = {
@@ -106,17 +127,10 @@
     g_printerr ("Usage: %s [OPTIONS] filename\n", argv[0]);
     return 1;
   }
-
-#if HAVE_GNOMEVFS
-  {
-    char *s;
-    s = gnome_vfs_make_uri_from_shell_arg (argv[1]);
-    loader = swfdec_gtk_loader_new (s);
-    g_free (s);
-  }
-#else
-  loader = swfdec_gtk_loader_new (argv[1]);
-#endif
+
+  s = sanitize_url (argv[1]);
+  loader = swfdec_gtk_loader_new (s);
+  g_free (s);
   if (loader->error) {
     g_printerr ("Couldn't open file \"%s\": %s\n", argv[1], loader->error);
     g_object_unref (loader);


igafb: use framebuffer_alloc() to allocate fb_info struct

Use the framebuffer_alloc() function to allocate the fb_info
structure so the structure is correctly initialized after allocation.

Signed-off-by: Krzysztof Helt <e36322531041744f35a39a40f0faffcfb5b388ff@wp.pl>
Cc: Geert Uytterhoeven <0da414d9d963da4039c2a0525b1844228075aa58@linux-m68k.org>
Cc: "David S. Miller" <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/video/igafb.c
+++ drivers/video/igafb.c
@@ -395,17 +395,16 @@
 	/* We leak a reference here but as it cannot be unloaded this is
 	   fine. If you write unload code remember to free it in unload */

-	size = sizeof(struct fb_info) + sizeof(struct iga_par) + sizeof(u32)*16;
-
-        info = kzalloc(size, GFP_ATOMIC);
+	size = sizeof(struct iga_par) + sizeof(u32)*16;
+
+	info = framebuffer_alloc(size, &pdev->dev);
         if (!info) {
                 printk("igafb_init: can't alloc fb_info\n");
 		 pci_dev_put(pdev);
                 return -ENOMEM;
         }

-	par = (struct iga_par *) (info + 1);
-
+	par = info->par;

 	if ((addr = pdev->resource[0].start) == 0) {
                 printk("igafb_init: no memory start\n");
@@ -526,7 +525,6 @@
 	info->var = default_var;
 	info->fix = igafb_fix;
 	info->pseudo_palette = (void *)(par + 1);
-	info->device = &pdev->dev;

 	if (!iga_init(info, par)) {
 		iounmap((void *)par->io_base);


ps3fb: don't keep the borders for non-fullscreen modes in XDR memory

Don't keep the borders for non-fullscreen modes in XDR memory:
  - Extract ps3fb_sync_image()
  - Work around the alignment restrictions of L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT
    by using an offset with L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP
  - Only copy the visible part of the screen on every vblank
  - Always put the real frame buffer at the start of video memory
  - Clear fullscreen DDR memory on mode change

Signed-off-by: Geert Uytterhoeven <205f5bcb2ea42515c4425a82ddba45c7ca0f2905@sonycom.com>
Cc: "Antonino A. Daplas" <be03a811842969f6b435f66cb85a30eb479a8702@pol.net>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/video/ps3fb.c
+++ drivers/video/ps3fb.c
@@ -54,6 +54,7 @@
 #define DDR_SIZE				(0)	/* used no ddr */
 #define GPU_CMD_BUF_SIZE			(64 * 1024)
 #define GPU_IOIF				(0x0d000000UL)
+#define GPU_ALIGN_UP(x)				_ALIGN_UP((x), 64)

 #define PS3FB_FULL_MODE_BIT			0x80

@@ -136,6 +137,10 @@
 	int mode_id, new_mode_id;
 	int res_index;
 	unsigned int num_frames;	/* num of frame buffers */
+	unsigned int width;
+	unsigned int height;
+	unsigned long full_offset;	/* start of fullscreen DDR fb */
+	unsigned long fb_offset;	/* start of actual DDR fb */
 };

 struct ps3fb_res_table {
@@ -291,15 +296,6 @@
 /* Start of the virtual frame buffer (relative to fullscreen ) */
 #define VP_OFF(i)	((WIDTH(i) * Y_OFF(i) + X_OFF(i)) * BPP)

-/*
- * Start of the virtual frame buffer (relative to start of video memory)
- * This is PAGE_SIZE aligned for easier mmap()
- */
-#define VFB_OFF(i)	PAGE_ALIGN(VP_OFF(i))
-
-/* Start of the fullscreen frame buffer (relative to start of video memory) */
-#define FB_OFF(i)	(-VP_OFF(i) & ~PAGE_MASK)
-

 static int ps3fb_mode;
 module_param(ps3fb_mode, int, 0);
@@ -386,18 +382,48 @@
 	return &ps3fb_modedb[mode - 1];
 }

+static void ps3fb_sync_image(struct device *dev, u64 frame_offset,
+			     u64 dst_offset, u64 src_offset, u32 width,
+			     u32 height, u64 line_length)
+{
+	int status;
+
+	status = lv1_gpu_context_attribute(ps3fb.context_handle,
+					   L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
+					   dst_offset, GPU_IOIF + src_offset,
+					   L1GPU_FB_BLIT_WAIT_FOR_COMPLETION |
+					   (width << 16) | height,
+					   line_length);
+	if (status)
+		dev_err(dev,
+			"%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n",
+			__func__, status);
+#ifdef HEAD_A
+	status = lv1_gpu_context_attribute(ps3fb.context_handle,
+					   L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP,
+					   0, frame_offset, 0, 0);
+	if (status)
+		dev_err(dev, "%s: lv1_gpu_context_attribute FLIP failed: %d\n",
+			__func__, status);
+#endif
+#ifdef HEAD_B
+	status = lv1_gpu_context_attribute(ps3fb.context_handle,
+					   L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP,
+					   1, frame_offset, 0, 0);
+	if (status)
+		dev_err(dev, "%s: lv1_gpu_context_attribute FLIP failed: %d\n",
+			__func__, status);
+#endif
+}
+
 static int ps3fb_sync(struct fb_info *info, u32 frame)
 {
 	struct ps3fb_par *par = info->par;
-	int i, status, error = 0;
+	int i, error = 0;
 	u32 xres, yres;
-	u64 fb_ioif, offset;
+	u64 line_length, base;

 	acquire_console_sem();
-
-	i = par->res_index;
-	xres = ps3fb_res[i].xres;
-	yres = ps3fb_res[i].yres;

 	if (frame > par->num_frames - 1) {
 		dev_dbg(info->device, "%s: invalid frame number (%u)\n",
@@ -405,43 +431,22 @@
 		error = -EINVAL;
 		goto out;
 	}
-	offset = xres * yres * BPP * frame;
-
-	fb_ioif = GPU_IOIF + FB_OFF(i) + offset;
-	status = lv1_gpu_context_attribute(ps3fb.context_handle,
-					   L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
-					   offset, fb_ioif,
-					   L1GPU_FB_BLIT_WAIT_FOR_COMPLETION |
-					   (xres << 16) | yres,
-					   xres * BPP);	/* line_length */
-	if (status)
-		dev_err(info->device,
-			"%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n",
-			__func__, status);
-#ifdef HEAD_A
-	status = lv1_gpu_context_attribute(ps3fb.context_handle,
-					   L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP,
-					   0, offset, 0, 0);
-	if (status)
-		dev_err(info->device,
-			"%s: lv1_gpu_context_attribute FLIP failed: %d\n",
-			__func__, status);
-#endif
-#ifdef HEAD_B
-	status = lv1_gpu_context_attribute(ps3fb.context_handle,
-					   L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP,
-					   1, offset, 0, 0);
-	if (status)
-		dev_err(info->device,
-			"%s: lv1_gpu_context_attribute FLIP failed: %d\n",
-			__func__, status);
-#endif
+
+	i = par->res_index;
+	xres = ps3fb_res[i].xres;
+	yres = ps3fb_res[i].yres;
+
+	line_length = xres * BPP;
+	base = frame * yres * line_length;
+
+	ps3fb_sync_image(info->device, base + par->full_offset,
+			 base + par->fb_offset, base, par->width, par->height,
+			 line_length);

 out:
 	release_console_sem();
 	return error;
 }
-

 static int ps3fb_open(struct fb_info *info, int user)
 {
@@ -472,7 +477,6 @@
 {
 	u32 line_length;
 	int mode;
-	int i;

 	dev_dbg(info->device, "var->xres:%u info->var.xres:%u\n", var->xres,
 		info->var.xres);
@@ -539,9 +543,7 @@
 	}

 	/* Memory limit */
-	i = ps3fb_get_res_table(var->xres, var->yres, mode);
-	if (ps3fb_res[i].xres*ps3fb_res[i].yres*BPP >
-	    ps3fb.xdr_size - VFB_OFF(i)) {
+	if (var->yres * line_length > ps3fb.xdr_size) {
 		dev_dbg(info->device, "Not enough memory\n");
 		return -ENOMEM;
 	}
@@ -559,9 +561,9 @@
 static int ps3fb_set_par(struct fb_info *info)
 {
 	struct ps3fb_par *par = info->par;
-	unsigned int mode;
+	unsigned int mode, lines, maxlines;
 	int i;
-	unsigned long offset;
+	unsigned long offset, dst;

 	dev_dbg(info->device, "xres:%d xv:%d yres:%d yv:%d clock:%d\n",
 		info->var.xres, info->var.xres_virtual,
@@ -574,17 +576,21 @@
 	i = ps3fb_get_res_table(info->var.xres, info->var.yres, mode);
 	par->res_index = i;

-	offset = VFB_OFF(i);
-	info->fix.smem_start = virt_to_abs(ps3fb.xdr_ea) + offset;
-	info->fix.smem_len = ps3fb.xdr_size - offset;
-	info->screen_base = (char __iomem *)ps3fb.xdr_ea + offset;
-	memset(ps3fb.xdr_ea, 0, ps3fb.xdr_size);
+	info->fix.smem_start = virt_to_abs(ps3fb.xdr_ea);
+	info->fix.smem_len = ps3fb.xdr_size;
+	info->screen_base = (char __iomem *)ps3fb.xdr_ea;

 	par->num_frames = info->fix.smem_len/
 			  (ps3fb_res[i].xres*ps3fb_res[i].yres*BPP);

 	/* Keep the special bits we cannot set using fb_var_screeninfo */
 	par->new_mode_id = (par->new_mode_id & ~PS3AV_MODE_MASK) | mode;
+
+	par->width = info->var.xres;
+	par->height = info->var.yres;
+	offset = VP_OFF(i);
+	par->fb_offset = GPU_ALIGN_UP(offset);
+	par->full_offset = par->fb_offset - offset;

 	if (par->new_mode_id != par->mode_id) {
 		if (ps3av_set_video_mode(par->new_mode_id)) {
@@ -592,6 +598,21 @@
 			return -EINVAL;
 		}
 		par->mode_id = par->new_mode_id;
+	}
+
+	/* Clear XDR frame buffer memory */
+	memset(ps3fb.xdr_ea, 0, ps3fb.xdr_size);
+
+	/* Clear DDR frame buffer memory */
+	lines = ps3fb_res[i].yres * par->num_frames;
+	if (par->full_offset)
+		lines++;
+	maxlines = ps3fb.xdr_size / info->fix.line_length;
+	for (dst = 0; lines; dst += maxlines * info->fix.line_length) {
+		unsigned int l = min(lines, maxlines);
+		ps3fb_sync_image(info->device, 0, dst, 0, ps3fb_res[i].xres, l,
+				 info->fix.line_length);
+		lines -= l;
 	}

 	return 0;
@@ -1005,7 +1026,6 @@
 	u64 lpar_reports_size = 0;
 	u64 xdr_lpar;
 	int status, res_index;
-	unsigned long offset;
 	struct task_struct *task;

 	status = ps3_open_hv_device(dev);
@@ -1088,13 +1108,12 @@
 	par->res_index = res_index;
 	par->num_frames = 1;

-	offset = VFB_OFF(res_index);
-	info->screen_base = (char __iomem *)ps3fb.xdr_ea + offset;
+	info->screen_base = (char __iomem *)ps3fb.xdr_ea;
 	info->fbops = &ps3fb_ops;

 	info->fix = ps3fb_fix;
-	info->fix.smem_start = virt_to_abs(ps3fb.xdr_ea) + offset;
-	info->fix.smem_len = ps3fb.xdr_size - offset;
+	info->fix.smem_start = virt_to_abs(ps3fb.xdr_ea);
+	info->fix.smem_len = ps3fb.xdr_size;
 	info->pseudo_palette = par->pseudo_palette;
 	info->flags = FBINFO_DEFAULT | FBINFO_READS_FAST;


Added assert_no_null

Added assert_no_null

--- include/herc/herc.h
+++ include/herc/herc.h
@@ -1,5 +1,7 @@
 #ifndef HERC_HERC_H
 #define HERC_HERC_H
+
+#include <stdlib.h>

 #define _HERC_CASE_NAME_DELIMITER _D5a_

@@ -8,8 +10,13 @@

 #define HTEST(test_case, test_name) void  _HERC_MANGLE(test_case, _HERC_CASE_NAME_DELIMITER, test_name) ()

+/*************
+ * assertions *
+ *************/

 #define assert_true(expr) if (!(expr)) {herc_fail("\"" #expr "\"" " expected to be true but was false");}
+
+#define assert_not_null(expr) if ((expr)==NULL) {herc_fail("\"" #expr "\"" " expected to be NULL but it isn't");}

 void herc_fail(const char *);


removed debug test

removed debug test

--- include/ieee80211.h
+++ include/ieee80211.h
@@ -103,19 +103,6 @@
 #define WPA_KEY_INFO_ERROR WBIT(10)
 #define WPA_KEY_INFO_REQUEST WBIT(11)
 #define WPA_KEY_INFO_ENCR_KEY_DATA WBIT(12) /* IEEE 802.11i/RSN only */
-
-#ifdef __BYTE_ORDER__
-#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-#define BIG_ENDIAN_HOST
-#endif
-#else
-#ifdef __OpenBSD__
-# include <endian.h>
-# if BYTE_ORDER == BIG_ENDIAN
-#   define BIG_ENDIAN_HOST
-# endif
-#endif
-#endif
 /*===========================================================================*/
 struct radiotap_header
 {
@@ -171,7 +158,6 @@
 typedef struct prism_item prism_item_t;
 typedef struct prism_header prism_t;
 #define	PRISM_SIZE (sizeof(prism_t))
-
 /*===========================================================================*/
 struct avs_header
 {


error: pathspec 'C/Algorithm/Variable.c' did not match any file(s) known to git

--- C/Algorithm/Variable.c
+++ C/Algorithm/Variable.c
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+int main() {
+	int x, y;
+	printf("Entre com 2 números: ");
+	scanf("%i %i", &x, &y);
+	int z = x + y;
+	printf("\n%i", z);
+}
+
+//https://pt.stackoverflow.com/q/121101/101


missing include

missing include

--- src/mongoc/mongoc-find-and-modify.c
+++ src/mongoc/mongoc-find-and-modify.c
@@ -19,7 +19,7 @@
 #include "mongoc-write-concern-private.h"
 #include "mongoc-find-and-modify.h"
 #include "mongoc-find-and-modify-private.h"
-#include "mongoc-log.h"
+#include "mongoc-util-private.h"

 /**


Aggregations: Range: Fix default key

Aggregations: Range: Fix default key

--- src/multivalue/aggregation_bucket.h
+++ src/multivalue/aggregation_bucket.h
@@ -230,7 +230,7 @@
 					case MsgPack::Type::POSITIVE_INTEGER:
 					case MsgPack::Type::NEGATIVE_INTEGER:
 					case MsgPack::Type::FLOAT:
-						interval_u64 = interval_value.u64();
+						interval_u64 = interval_value.as_u64();
 						break;
 					default:
 						THROW(AggregationError, "'%s' must be numeric", AGGREGATION_INTERVAL);
@@ -241,7 +241,7 @@
 					case MsgPack::Type::POSITIVE_INTEGER:
 					case MsgPack::Type::NEGATIVE_INTEGER:
 					case MsgPack::Type::FLOAT:
-						interval_i64 = interval_value.i64();
+						interval_i64 = interval_value.as_i64();
 						break;
 					default:
 						THROW(AggregationError, "'%s' must be numeric", AGGREGATION_INTERVAL);
@@ -255,7 +255,7 @@
 					case MsgPack::Type::POSITIVE_INTEGER:
 					case MsgPack::Type::NEGATIVE_INTEGER:
 					case MsgPack::Type::FLOAT:
-						interval_f64 = interval_value.f64();
+						interval_f64 = interval_value.as_f64();
 						break;
 					default:
 						THROW(AggregationError, "'%s' must be numeric", AGGREGATION_INTERVAL);
@@ -322,6 +322,7 @@

 	void configure_u64(const MsgPack& ranges) {
 		for (const auto& range : ranges) {
+			std::string default_key;
 			std::string_view key;
 			auto key_it = range.find(AGGREGATION_KEY);
 			if (key_it != range.end()) {
@@ -355,7 +356,7 @@
 					case MsgPack::Type::POSITIVE_INTEGER:
 					case MsgPack::Type::NEGATIVE_INTEGER:
 					case MsgPack::Type::FLOAT:
-						to_u64 = to_value.u64();
+						to_u64 = to_value.as_u64();
 						break;
 					default:
 						THROW(AggregationError, "'%s' must be numeric", AGGREGATION_TO);
@@ -363,7 +364,8 @@
 			}

 			if (key.empty()) {
-				key = _as_bucket(from_u64, to_u64);
+				default_key = _as_bucket(from_u64, to_u64);
+				key = default_key;
 			}
 			ranges_u64.emplace_back(key, std::make_pair(from_u64, to_u64));
 		}
@@ -371,6 +373,7 @@

 	void configure_i64(const MsgPack& ranges) {
 		for (const auto& range : ranges) {
+			std::string default_key;
 			std::string_view key;
 			auto key_it = range.find(AGGREGATION_KEY);
 			if (key_it != range.end()) {
@@ -404,7 +407,7 @@
 					case MsgPack::Type::POSITIVE_INTEGER:
 					case MsgPack::Type::NEGATIVE_INTEGER:
 					case MsgPack::Type::FLOAT:
-						to_i64 = to_value.i64();
+						to_i64 = to_value.as_i64();
 						break;
 					default:
 						THROW(AggregationError, "'%s' must be numeric", AGGREGATION_TO);
@@ -412,7 +415,8 @@
 			}

 			if (key.empty()) {
-				key = _as_bucket(from_i64, to_i64);
+				default_key = _as_bucket(from_i64, to_i64);
+				key = default_key;
 			}
 			ranges_i64.emplace_back(key, std::make_pair(from_i64, to_i64));
 		}
@@ -420,6 +424,7 @@

 	void configure_f64(const MsgPack& ranges) {
 		for (const auto& range : ranges) {
+			std::string default_key;
 			std::string_view key;
 			auto key_it = range.find(AGGREGATION_KEY);
 			if (key_it != range.end()) {
@@ -453,7 +458,7 @@
 					case MsgPack::Type::POSITIVE_INTEGER:
 					case MsgPack::Type::NEGATIVE_INTEGER:
 					case MsgPack::Type::FLOAT:
-						to_f64 = to_value.f64();
+						to_f64 = to_value.as_f64();
 						break;
 					default:
 						THROW(AggregationError, "'%s' must be numeric", AGGREGATION_TO);
@@ -461,7 +466,8 @@
 			}

 			if (key.empty()) {
-				key = _as_bucket(from_f64, to_f64);
+				default_key = _as_bucket(from_f64, to_f64);
+				key = default_key;
 			}
 			ranges_f64.emplace_back(key, std::make_pair(from_f64, to_f64));
 		}


Fixes more issues

Fixes more issues

--- CProject/UWFSSD/User.c
+++ CProject/UWFSSD/User.c
@@ -148,6 +148,10 @@
 		strncpy(record->performingPerson, csvData[2], 33);

 		lastRecordImmu->item = record;
+		if(i + 1 >= numberOfRecords) {
+			lastRecordImmu->next = NULL;
+			break;
+		}
 		lastRecordImmu->next = malloc(sizeof(ImmunizationListT));

 		if(lastRecordImmu->next == NULL) {
@@ -208,6 +212,10 @@
 		strncpy(record->prescribingPerson, csvData[2], 33);

 		lastRecordMedi->item = record;
+		if(i + 1 >= numberOfRecords) {
+			lastRecordMedi->next = NULL;
+			break;
+		}
 		lastRecordMedi->next = malloc(sizeof(MedicationListT));

 		if(lastRecordMedi->next == NULL) {
@@ -278,6 +286,10 @@
 		strncpy(record->personSeen, csvData[3], 33);

 		lastVisitRecord->item = record;
+		if(i + 1 >= numberOfRecords) {
+			lastVisitRecord->next = NULL;
+			break;
+		}
 		lastVisitRecord->next = malloc(sizeof(VisitT));

 		if(lastVisitRecord->next == NULL) {
@@ -330,6 +342,10 @@
 		strncpy(record->testResults, csvData[1], 120);

 		lastTestRecord->item = record;
+		if(i + 1 >= numberOfRecords) {
+			lastTestRecord->next = NULL;
+			break;
+		}
 		lastTestRecord->next = malloc(sizeof(TestResultT));

 		if(lastTestRecord->next == NULL) {


idr: document exit conditions on idr_for_each_entry better

And some manual common subexpression elimination which may help the
compiler produce smaller code.

Signed-off-by: George Spelvin <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@horizon.com>
Signed-off-by: Philipp Reisner <35a55a4ac466b5abd81eb66f3f7d6a972dd0dc24@linbit.com>
Signed-off-by: Jens Axboe <cd8c6775e60d6f67a6984377324e5290df3d5358@kernel.dk>

--- include/linux/idr.h
+++ include/linux/idr.h
@@ -122,11 +122,13 @@
  * @idp:     idr handle
  * @entry:   the type * to use as cursor
  * @id:      id entry's key
- */
-#define idr_for_each_entry(idp, entry, id)				\
-	for (id = 0, entry = (typeof(entry))idr_get_next((idp), &(id)); \
-	     entry != NULL;                                             \
-	     ++id, entry = (typeof(entry))idr_get_next((idp), &(id)))
+ *
+ * @entry and @id do not need to be initialized before the loop, and
+ * after normal terminatinon @entry is left with the value NULL.  This
+ * is convenient for a "not found" value.
+ */
+#define idr_for_each_entry(idp, entry, id)			\
+	for (id = 0; ((entry) = idr_get_next(idp, &(id))) != NULL; ++id)

 /*
  * Don't use the following functions.  These exist only to suppress


wusb: add authenticathed bit to usb_dev

wusb: add authenticathed bit to usb_dev

This bit indicates the system that the WUSB device has been crypto
authenticated and thus can operate as normal.

Signed-off-by: Inaky Perez-Gonzalez <32fcc484d967529190dea5c4cba96be3030624cc@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@suse.de>

--- include/linux/usb.h
+++ include/linux/usb.h
@@ -372,6 +372,7 @@
  *	used or not. By default, wired USB devices are authorized.
  *	WUSB devices are not, until we authorize them from user space.
  *	FIXME -- complete doc
+ * @authenticated: Crypto authentication passed
  * @wusb: device is Wireless USB
  * @string_langid: language ID for strings
  * @product: iProduct string, if present (static)
@@ -438,6 +439,7 @@
 	unsigned persist_enabled:1;
 	unsigned have_langid:1;
 	unsigned authorized:1;
+ 	unsigned authenticated:1;
 	unsigned wusb:1;
 	int string_langid;


Enable reading back value of cyw43 pin

Enable reading back value of cyw43 pin

Now, `led.value = not led.value` works as a way to toggle the LED state.

Closes: #6959

--- ports/raspberrypi/common-hal/digitalio/DigitalInOut.c
+++ ports/raspberrypi/common-hal/digitalio/DigitalInOut.c
@@ -140,6 +140,11 @@

 bool common_hal_digitalio_digitalinout_get_value(
     digitalio_digitalinout_obj_t *self) {
+    #if CIRCUITPY_CYW43
+    if (IS_CYW(self)) {
+        return cyw43_arch_gpio_get(self->pin->number);
+    }
+    #endif
     return gpio_get(self->pin->number);
 }


Update the copyright notice

Update the copyright notice

--- include/math/math.h
+++ include/math/math.h
@@ -1,5 +1,5 @@
 /* $Id$ */
-/* Copyright (c) 2009 Pierre Pronchery <khorben@defora.org> */
+/* Copyright (c) 2008-2017 Pierre Pronchery <khorben@defora.org> */
 /* This file is part of DeforaOS System libc */
 /* All rights reserved.
  *


[JUnitXmlLogger] Fix lint issues.

[JUnitXmlLogger] Fix lint issues.

--- src/native/loggers/JUnitXmlLogger.c
+++ src/native/loggers/JUnitXmlLogger.c
@@ -64,7 +64,7 @@
     char    *hostname;
     int     suiteId;
 } globalInfo = {
-    0
+    NULL, 0
 };

 /** The information about the current suite. */
@@ -79,7 +79,7 @@
     float   time;
     char    *timestamp;
 } suiteInfo = {
-    0,
+    0, 0, 0, NULL, NULL, NULL, 0, 0.0, NULL
 };

 /** Initializes all global variables and prepares global log file output.


The ip_version in the metadata is a uint16_t in the spec

--- include/maxminddb.h
+++ include/maxminddb.h
@@ -118,7 +118,7 @@
 typedef struct MMDB_metadata_s {
     uint32_t node_count;
     uint16_t record_size;
-    uint8_t ip_version;
+    uint16_t ip_version;
     const char *database_type;
     struct {
         size_t count;


typos in messsage (PR 35340).

typos in messsage (PR 35340).

git-svn-id: d2ff9ed2f92be9d06337bb70c57551c02d1e392c@232857 13f79535-47bb-0310-9956-ffa450edef68

--- src/native/nt/procrun/src/javajni.c
+++ src/native/nt/procrun/src/javajni.c
@@ -339,7 +339,7 @@
         }
         lpJava->iVersion = JNICALL_0(GetVersion);
         if (lpJava->iVersion < JNI_VERSION_1_2) {
-            apxLogWrite(APXLOG_MARK_ERROR "Unsuported JNI version %#08x", lpJava->iVersion);
+            apxLogWrite(APXLOG_MARK_ERROR "Unsupported JNI version %#08x", lpJava->iVersion);
             return FALSE;
         }
         rv = TRUE;
@@ -360,7 +360,7 @@
         }
         /* we need at least 1.2 JNI */
         if ((lpJava->iVersion = vmArgs11.version) < JNI_VERSION_1_2) {
-            apxLogWrite(APXLOG_MARK_ERROR "Unsuported JNI version %d", vmArgs11.version);
+            apxLogWrite(APXLOG_MARK_ERROR "Unsupported JNI version %d", vmArgs11.version);
             return FALSE;
         }
         if (dwMs)


productor and consumer using atomic and signal. this just header file.

error: pathspec 'practise/productor-consumer/atomic-signal/productor.h' did not match any file(s) known to git

--- practise/productor-consumer/atomic-signal/productor.h
+++ practise/productor-consumer/atomic-signal/productor.h
@@ -0,0 +1,42 @@
+#ifndef _PRODUCTOR_H_
+
+namespace AtomicSignal {
+
+// using same AtomicSingnal in Productor and Consumer.
+class AtomicSignal;
+
+// using same pointer of Data in Productor and Consumer.
+typedef vector<shared_ptr<char>> Data;
+
+class Productor {
+public:
+	Productor(shared_ptr<AtomicSignal> as, shared_ptr<Data> data)
+	: m_atomic_signal(as),
+	  m_data(data)
+	{ };
+	~Productor() { };
+
+	void p(void *d);
+
+	shared_ptr<AtomicSignal> m_atomic_signal;
+	shared_ptr<Data> m_data;
+};
+
+class Consumer {
+public:
+	Consumer(shared_ptr<AtomicSignal> as, shared_ptr<Data> data)
+		: m_atomic_signal(as),
+		  m_data(data)
+	{ };
+	~Consumer() { };
+
+	void v(void **d);
+
+	shared_ptr<AtomicSignal> m_atomic_signal;
+	shared_ptr<Data> m_data;
+};
+
+};
+
+#endif
+


include/media/: Spelling fixes

include/media/: Spelling fixes

Signed-off-by: Joe Perches <16a9a54ddf4259952e3c118c763138e83693d7fd@perches.com>
Signed-off-by: Adrian Bunk <0b86548ef377da0031a3ff3f0c4e06f016e20105@kernel.org>

--- include/media/rds.h
+++ include/media/rds.h
@@ -4,7 +4,7 @@
     saa6588.c and every driver (e.g. bttv-driver.c) that wants
     to use the saa6588 module.

-    Instead of having a seperate rds.h, I'd prefer to include
+    Instead of having a separate rds.h, I'd prefer to include
     this stuff in one of the already existing files like tuner.h

     (c) 2005 by Hans J. Koch


Changes to fix building on Windows.

Changes to fix building on Windows.

--- include/my_global.h
+++ include/my_global.h
@@ -1479,14 +1479,10 @@
 #endif

 /*
-  Define placement versions of operator new and operator delete since
-  we cannot be sure that the <new> include exists.
+  Include standard definitions of operator new and delete.
  */
 #ifdef __cplusplus
-inline void *operator new(size_t, void *ptr) { return ptr; }
-inline void *operator new[](size_t, void *ptr) { return ptr; }
-inline void  operator delete(void*, void*) { /* Do nothing */ }
-inline void  operator delete[](void*, void*) { /* Do nothing */ }
+#include <new>
 #endif

 #endif /* my_global_h */


typed moved to a proper place

typed moved to a proper place

--- include/my_global.h
+++ include/my_global.h
@@ -640,9 +640,6 @@
 typedef long long	my_ptrdiff_t;
 #endif

-/* typedef used for length of string;  Should be unsigned! */
-typedef ulong		size_str;
-
 #define MY_ALIGN(A,L)	(((A) + (L) - 1) & ~((L) - 1))
 #define ALIGN_SIZE(A)	MY_ALIGN((A),sizeof(double))
 /* Size to make adressable obj. */
@@ -710,6 +707,9 @@
 typedef long		longlong;
 #endif
 #endif
+
+/* typedef used for length of string;  Should be unsigned! */
+typedef ulong		size_str;

 #ifdef USE_RAID
 /*


Forgot to add test-mail-storage.h in an earlier comment.

--HG--
branch : HEAD

error: pathspec 'src/lib-storage/test-mail-storage.h' did not match any file(s) known to git

--- src/lib-storage/test-mail-storage.h
+++ src/lib-storage/test-mail-storage.h
@@ -0,0 +1,16 @@
+#ifndef TEST_MAIL_STORAGE_H
+#define TEST_MAIL_STORAGE_H
+
+struct mail_storage *test_mail_storage_create(void);
+
+struct mailbox *
+test_mailbox_open(struct mail_storage *storage, struct mailbox_list *list,
+		  const char *name, struct istream *input,
+		  enum mailbox_open_flags flags);
+
+struct mail *
+test_mailbox_mail_alloc(struct mailbox_transaction_context *t,
+			enum mail_fetch_field wanted_fields,
+			struct mailbox_header_lookup_ctx *wanted_headers);
+
+#endif


pm: device: remove internal comment

pm: device: remove internal comment

The comment provides internal details which are not relevant.

Signed-off-by: Gerard Marull-Paretas <bedb45f43a286e49f4dcda039a436b216ae61ef3@nordicsemi.no>

--- include/pm/device.h
+++ include/pm/device.h
@@ -96,7 +96,6 @@
 	const struct device *dev;
 	/** Lock to synchronize the get/put operations */
 	struct k_mutex lock;
-	/* Following are packed fields protected by #lock. */
 	/** Device pm enable flag */
 	bool enable : 1;
 	/** Device usage count */


Add SceCtrlPortInfo structure

Add SceCtrlPortInfo structure

--- include/psp2/ctrl.h
+++ include/psp2/ctrl.h
@@ -47,6 +47,15 @@
 	SCE_CTRL_ANY        = 0x010000	//!< Any input intercepted.
 };

+/** Enumeration for the controller types. */
+enum {
+	SCE_CTRL_TYPE_UNPAIRED  = 0,
+	SCE_CTRL_TYPE_PHY       = 1, //!< Physical controller for VITA
+	SCE_CTRL_TYPE_VIRT      = 2, //!< Virtual controller for PSTV
+	SCE_CTRL_TYPE_DS3       = 4, //!< DualShock 3
+	SCE_CTRL_TYPE_DS4       = 8  //!< DualShock 4
+};
+
 /** Controller mode. */
 enum {
 	/** Digitial buttons only. */
@@ -91,6 +100,12 @@
 	int unk;     //!< Unknown
 } SceCtrlActuator;

+/** Structure to pass as argument to ::sceCtrlGetControllerPortInfo */
+typedef struct SceCtrlPortInfo {
+	uint8_t port[5];  //!< Controller type of each ports
+	uint8_t unk[11];  //!< Unknown
+} SceCtrlPortInfo;
+
 /**
  * Set the controller mode.
  *
@@ -221,10 +236,10 @@
 /**
  * Get controller port information.
  *
- * @param[out] info - Return value, use char[16] buffer
+ * @param[out] info - see ::SceCtrlPortInfo
  * @return 0, <0 on error
  */
-int sceCtrlGetControllerPortInfo(void *info);
+int sceCtrlGetControllerPortInfo(SceCtrlPortInfo *info);
 #ifdef __cplusplus
 }
 #endif


Low: qbipcs.h: update ipcs connection iterator documentation

--- include/qb/qbipcs.h
+++ include/qb/qbipcs.h
@@ -388,7 +388,7 @@
 /**
  * Get the first connection.
  *
- * @note call qb_ipcs_connection_ref_dec() after using the connection.
+ * @note call qb_ipcs_connection_unref() after using the connection.
  *
  * @param pt service instance
  * @return first connection
@@ -398,7 +398,7 @@
 /**
  * Get the next connection.
  *
- * @note call qb_ipcs_connection_ref_dec() after using the connection.
+ * @note call qb_ipcs_connection_unref() after using the connection.
  *
  * @param pt service instance
  * @param current current connection


ecore: fix SOCKS proxy doc. That should be in doxygen anyway. Wondering
how.

SVN revision: 70924

--- src/lib/ecore_con/ecore_con_socks.c
+++ src/lib/ecore_con/ecore_con_socks.c
@@ -557,7 +557,7 @@
    unsigned char addr6[sizeof(struct in6_addr)];
 #endif

-   /* ECORE_CON_SOCKS_V4=[user@]host:port-[1|0] */
+   /* ECORE_CON_SOCKS_V4=[user@]host-port:[1|0] */
    socks = getenv("ECORE_CON_SOCKS_V4");
    if (!socks)
      {


branches/zip: sync0sync.h: Define mutex_free as mutex0_free, because symbols defined in innodb_redefine.h must not be undefined.  After this change, innodb_redefine.h will define mutex0_free instead of mutex_free, and everything is fine.

--- include/sync0sync.h
+++ include/sync0sync.h
@@ -76,6 +76,10 @@
 is checked to be in the reset state. */

 #undef mutex_free			/* Fix for MacOS X */
+#define mutex_free mutex0_free		/* Fix for innodb_redefine.h;
+					we must not undefine symbols
+					defined there; thus, that file
+					will use mutex0_free. */
 void
 mutex_free(
 /*=======*/


docs: Fix typo in mutex docs

docs: Fix typo in mutex docs

-EACCESS should be -EACCES

Signed-off-by: Guðni Már Gilbert <a67b89b8b42b5e36ccc84f3061af0045ff2a5bff@gmail.com>

--- include/sys/mutex.h
+++ include/sys/mutex.h
@@ -98,7 +98,7 @@
  * @retval 0 Mutex locked.
  * @retval -EBUSY Returned without waiting.
  * @retval -EAGAIN Waiting period timed out.
- * @retval -EACCESS Caller has no access to provided mutex address
+ * @retval -EACCES Caller has no access to provided mutex address
  * @retval -EINVAL Provided mutex not recognized by the kernel
  */
 static inline int sys_mutex_lock(struct sys_mutex *mutex, k_timeout_t timeout)
@@ -118,7 +118,7 @@
  * thread.
  *
  * @param mutex Address of the mutex, which may reside in user memory
- * @retval -EACCESS Caller has no access to provided mutex address
+ * @retval -EACCES Caller has no access to provided mutex address
  * @retval -EINVAL Provided mutex not recognized by the kernel or mutex wasn't
  *                 locked
  * @retval -EPERM Caller does not own the mutex


splint fiddles.

splint fiddles.

--- popthelp.c
+++ popthelp.c
@@ -13,6 +13,7 @@
 #define	POPT_WCHAR_HACK
 #ifdef 	POPT_WCHAR_HACK
 #include <wchar.h>			/* for mbsrtowcs */
+/*@access mbstate_t @*/
 #endif
 #include "poptint.h"

@@ -340,11 +341,11 @@
 		mbstate_t t;
 		size_t n;

-		memset (&t, '\0', sizeof (t));	/* In initial state.  */
+		memset ((void *)&t, '\0', sizeof (t));	/* In initial state.  */
 		/* Determine number of characters.  */
 		n = mbsrtowcs (NULL, &scopy, strlen(scopy), &t);

-		displaypad = (lelen-n);
+		displaypad = (int) (lelen-n);
 	    }
 #endif
 	}
@@ -381,7 +382,7 @@
 	while (ch > (help + 1) && isspace(*ch)) ch--;
 	ch++;

-	sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), indentLength);
+	sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), (int) indentLength);
 	/*@-formatconst@*/
 	fprintf(fp, format, help, " ");
 	/*@=formatconst@*/
@@ -439,7 +440,9 @@
 		mbstate_t t;
 		size_t n;

-		memset (&t, '\0', sizeof (t));	/* In initial state.  */
+/*@-boundswrite@*/
+		memset ((void *)&t, '\0', sizeof (t));	/* In initial state.  */
+/*@=boundswrite@*/
 		/* Determine number of characters.  */
 		n = mbsrtowcs (NULL, &scopy, strlen(scopy), &t);
 		len += sizeof("=")-1 + n;
@@ -613,7 +616,9 @@
 	mbstate_t t;
 	size_t n;

-	memset (&t, '\0', sizeof (t));	/* In initial state.  */
+/*@-boundswrite@*/
+	memset ((void *)&t, '\0', sizeof (t));	/* In initial state.  */
+/*@=boundswrite@*/
 	/* Determine number of characters.  */
 	n = mbsrtowcs (NULL, &scopy, strlen(scopy), &t);
 	len += sizeof("=")-1 + n;


Fix UA_Server_writeArrayDimensions (#2455)

--- include/ua_server.h
+++ include/ua_server.h
@@ -404,7 +404,7 @@
 static UA_INLINE UA_StatusCode
 UA_Server_writeArrayDimensions(UA_Server *server, const UA_NodeId nodeId,
                                const UA_Variant arrayDimensions) {
-    return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_VALUE,
+    return __UA_Server_write(server, &nodeId, UA_ATTRIBUTEID_ARRAYDIMENSIONS,
                              &UA_TYPES[UA_TYPES_VARIANT], &arrayDimensions);
 }


Remove leftover #endif

Remove leftover #endif

--- include/vlc_mtime.h
+++ include/vlc_mtime.h
@@ -75,7 +75,6 @@
  */
 # define VLC_HARD_MIN_SLEEP 10000   /* 10 milliseconds = 1 tick at 100Hz */
 # define VLC_SOFT_MIN_SLEEP 9000000 /* 9 seconds */
-#endif

 static
 __attribute__((unused))


don't destruct primitive types in Array

don't destruct primitive types in Array

--- include/vnl/Array.h
+++ include/vnl/Array.h
@@ -9,6 +9,7 @@
 #define INCLUDE_PHY_ARRAY_H_

 #include <vector>
+#include <type_traits>

 #include <vnl/Memory.h>

@@ -113,8 +114,10 @@

 	void clear() {
 		if(p_front) {
-			for(iterator iter = begin(); iter != end(); ++iter) {
-				iter->~T();
+			if(std::is_class<T>::value) {
+				for(iterator iter = begin(); iter != end(); ++iter) {
+					iter->~T();
+				}
 			}
 			p_front->free_all();
 			p_front = 0;


fix header

fix header

--- include/ydsh/ydsh.h
+++ include/ydsh/ydsh.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2020 Nagisa Sekiguchi
+ * Copyright (C) 2015-2021 Nagisa Sekiguchi
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -118,7 +118,7 @@
  * if cannot resolve path, return null.
  * if st is null, return null
  */
-DS_PUBLIC_API(const) char *DSState_initExecutablePath(DSState *st);
+DS_PUBLIC_API(const char *) DSState_initExecutablePath(DSState *st);

 /**
  * get current exit status ($? & 0xFF)


bugfix

bugfix

--- core/cphvb.c
+++ core/cphvb.c
@@ -116,7 +116,7 @@
     for (--dim; dim >= 0 ; --dim)
     {
         offset += (element / dimbound) * stride[dim];
-        dimbound *= shape[dim];
+        dimbound *= stride[dim]?shape[dim]:1;
     }
     return offset;
 }


TB-1378 - Fix the overlapping error codes inside libetpan

Set MAILIMAP_ERROR_* codes to start at 1000, so that they don't
overlap with MAIL_ERROR_*.  Both these codes are coming out the
MailCore interface, so the overlapping code ranges is causing problems
diagnosing errors.

Notably, MAIL_ERROR_FETCH and MAILIMAP_ERROR_LOGIN were both 26.

--- src/low-level/imap/mailimap_types.h
+++ src/low-level/imap/mailimap_types.h
@@ -3322,7 +3322,7 @@
   MAILIMAP_NO_ERROR = 0,
   MAILIMAP_NO_ERROR_AUTHENTICATED = 1,
   MAILIMAP_NO_ERROR_NON_AUTHENTICATED = 2,
-  MAILIMAP_ERROR_BAD_STATE,
+  MAILIMAP_ERROR_BAD_STATE = 1000,  // Start at 1000 so that we don't overlap with MAIL_ERROR_*.
   MAILIMAP_ERROR_STREAM,
   MAILIMAP_ERROR_PARSE,
   MAILIMAP_ERROR_CONNECTION_REFUSED,


Fixed compile warning

Fixed compile warning

--- src/packet/packet_block_placement.c
+++ src/packet/packet_block_placement.c
@@ -57,7 +57,7 @@
 			--real_y;
 			break;
 		case UP_Y:
-			if (real_y == ~0)
+			if (real_y == (uint8_t) ~0)
 				return ERROR_NOT_ALLOWED;
 			++real_y;
 			break;


Update unionread.c

Update unionread.c

--- src/machinetalk/support/unionread.c
+++ src/machinetalk/support/unionread.c
@@ -39,19 +39,18 @@
     uint64_t taghdr;
     pb_wire_type_t wiretype;

-#if 1
     if (!pb_decode_varint(stream, &taghdr)) {
 	printf("Parsing taghdr failed: %s\n", PB_GET_ERROR(stream));
     }
     tag = taghdr >> 3;
     wiretype = taghdr & 0x07;
-#else
+/**********************************************************
     bool eof;
     // It is a submessage encoded in length-delimited format
     if (!pb_decode_tag(stream, &wiretype, &tag, &eof))  {
 	printf("Parsing tag#3 failed: %s\n", PB_GET_ERROR(stream));
     }
-#endif
+***********************************************************/
     printf("wiretype=%d tag=%d (submessage type)\n", wiretype, tag);
     assert(wiretype == 2); // length-delimited format


Placement works

Placement works

--- src/packet/packet_block_placement.c
+++ src/packet/packet_block_placement.c
@@ -12,7 +12,8 @@
 	DOWN_Z,
 	UP_Z,
 	DOWN_X,
-	UP_X
+	UP_X,
+	UPDATE = 0xFF
 };

 int packet_block_placement(struct bedrock_client *client, const bedrock_packet *p)
@@ -44,6 +45,8 @@
 		packet_read_int(p, &offset, &metadata, sizeof(metadata));
 	}

+	printf("%d %d %d %d %d %d %d\n", x, y, z, d, id, count, metadata);
+
 	real_x = x;
 	real_y = y;
 	real_z = z;
@@ -80,6 +83,11 @@
 				return ERROR_NOT_ALLOWED;
 			++real_x;
 			break;
+		case UPDATE:
+			// This packet has a special case where X, Y, Z, and Direction are all -1.
+			// This special packet indicates that the currently held item for the player should have its state
+			// updated such as eating food, shooting bows, using buckets, etc.
+			return offset;
 		default: // Unknwn direction
 			return ERROR_NOT_ALLOWED;
 	}
@@ -96,7 +104,6 @@
 	{
 		int16_t *weilded_id = nbt_read(weilded_item, TAG_SHORT, 1, "id");
 		uint8_t *weilded_count = nbt_read(weilded_item, TAG_BYTE, 1, "Count");
-		int16_t *weilded_metadata = nbt_read(weilded_item, TAG_SHORT, 1, "Damage");

 		// At this point the client has already removed one
 		*weilded_count -= 1;
@@ -115,10 +122,6 @@
 		}

 		bedrock_log(LEVEL_DEBUG, "player building: %s is placing block of type %s at %d,%d,%d, direction %d", client->name, block->name, x, y, z, d);
-
-		printf("%d %d\n", count, *weilded_count);
-	//	if (id != *weilded_id || count != *weilded_count || metadata != *weilded_metadata)
-		//	return ERROR_UNEXPECTED;

 		if (*weilded_count == 0)
 			nbt_free(weilded_item);


Fix naming of map handler functions

Fix naming of map handler functions

--- src/php/handlers/php_map_handlers.c
+++ src/php/handlers/php_map_handlers.c
@@ -5,7 +5,7 @@

 zend_object_handlers php_map_handlers;

-static zval *php_php_ds_map_write_dimension(zval *obj, zval *offset, int type, zval *return_value)
+static zval *php_ds_map_read_dimension(zval *obj, zval *offset, int type, zval *return_value)
 {
     ds_map_t *map = Z_DS_MAP_P(obj);

@@ -14,7 +14,6 @@
         return NULL;

     } else {
-
         zval *value = ds_map_get(map, offset, NULL);

         if (value && type != BP_VAR_R) {
@@ -25,7 +24,7 @@
     }
 }

-static void ds_map_write_dimension(zval *obj, zval *offset, zval *value)
+static void php_ds_map_write_dimension(zval *obj, zval *offset, zval *value)
 {
     ds_map_t *map = Z_DS_MAP_P(obj);

@@ -37,44 +36,44 @@
     ds_htable_put(map->table, offset, value);
 }

-static int ds_map_has_dimension(zval *obj, zval *offset, int check_empty)
+static int php_ds_map_has_dimension(zval *obj, zval *offset, int check_empty)
 {
     ds_map_t *map = Z_DS_MAP_P(obj);

     return ds_htable_isset(map->table, offset, check_empty);
 }

-static void ds_map_unset_dimension(zval *obj, zval *offset)
+static void php_ds_map_unset_dimension(zval *obj, zval *offset)
 {
     ds_map_t *map = Z_DS_MAP_P(obj);
     ds_htable_remove(map->table, offset, NULL);
 }

-static int ds_map_count_elements(zval *obj, zend_long *count)
+static int php_ds_map_count_elements(zval *obj, zend_long *count)
 {
     *count = DS_MAP_SIZE(Z_DS_MAP_P(obj));
     return SUCCESS;
 }

-static void ds_map_free_object(zend_object *object)
+static void php_ds_map_free_object(zend_object *object)
 {
     php_ds_map_t *intern = (php_ds_map_t*) object;
     zend_object_std_dtor(&intern->std);
     ds_map_free(intern->map);
 }

-static HashTable *ds_map_get_debug_info(zval *obj, int *is_temp)
+static HashTable *php_ds_map_get_debug_info(zval *obj, int *is_temp)
 {
     *is_temp = 1;
     return ds_map_pairs_to_php_hashtable(Z_DS_MAP_P(obj));
 }

-static zend_object *ds_map_clone_obj(zval *obj)
+static zend_object *php_ds_map_clone_obj(zval *obj)
 {
     return php_ds_map_create_clone(Z_DS_MAP_P(obj));
 }

-static HashTable *ds_map_get_gc(zval *obj, zval **gc_data, int *gc_count)
+static HashTable *php_ds_map_get_gc(zval *obj, zval **gc_data, int *gc_count)
 {
     ds_map_t *map = Z_DS_MAP_P(obj);

@@ -94,18 +93,17 @@
 {
     memcpy(&php_map_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));

-    php_map_handlers.offset = XtOffsetOf(php_ds_map_t, std);
-
-    php_map_handlers.dtor_obj            = zend_objects_destroy_object;
-    php_map_handlers.get_gc              = ds_map_get_gc;
-    php_map_handlers.free_obj            = ds_map_free_object;
-    php_map_handlers.clone_obj           = ds_map_clone_obj;
-    php_map_handlers.get_debug_info      = ds_map_get_debug_info;
-    php_map_handlers.count_elements      = ds_map_count_elements;
-    php_map_handlers.read_dimension      = php_php_ds_map_write_dimension;
-    php_map_handlers.write_dimension     = ds_map_write_dimension;
-    php_map_handlers.has_dimension       = ds_map_has_dimension;
-    php_map_handlers.unset_dimension     = ds_map_unset_dimension;
-    php_map_handlers.cast_object         = php_ds_default_cast_object;
+    php_map_handlers.offset             = 0;
+    php_map_handlers.dtor_obj           = zend_objects_destroy_object;
+    php_map_handlers.get_gc             = php_ds_map_get_gc;
+    php_map_handlers.free_obj           = php_ds_map_free_object;
+    php_map_handlers.clone_obj          = php_ds_map_clone_obj;
+    php_map_handlers.get_debug_info     = php_ds_map_get_debug_info;
+    php_map_handlers.count_elements     = php_ds_map_count_elements;
+    php_map_handlers.read_dimension     = php_ds_map_read_dimension;
+    php_map_handlers.write_dimension    = php_ds_map_write_dimension;
+    php_map_handlers.has_dimension      = php_ds_map_has_dimension;
+    php_map_handlers.unset_dimension    = php_ds_map_unset_dimension;
+    php_map_handlers.cast_object        = php_ds_default_cast_object;
     // php_map_handlers.get_properties      = ds_map_get_properties;
 }