dm: fix reload failure of 0 path multipath mapping on blk-mq devices

dm-multipath accepts 0 path mapping.

  # echo '0 2097152 multipath 0 0 0 0' | dmsetup create newdev

Such a mapping can be used to release underlying devices while still
holding requests in its queue until working paths come back.

However, once the multipath device is created over blk-mq devices,
it rejects reloading of 0 path mapping:

  # echo '0 2097152 multipath 0 0 1 1 queue-length 0 1 1 /dev/sda 1' \
      | dmsetup create mpath1
  # echo '0 2097152 multipath 0 0 0 0' | dmsetup load mpath1
  device-mapper: reload ioctl on mpath1 failed: Invalid argument
  Command failed

With following kernel message:
  device-mapper: ioctl: can't change device type after initial table load.

DM tries to inherit the current table type using dm_table_set_type()
but it doesn't work as expected because of unnecessary check about
whether the target type is hybrid or not.

Hybrid type is for targets that work as either request-based or bio-based
and not required for blk-mq or non blk-mq checking.

Fixes: 65803c205983 ("dm table: train hybrid target type detection to select blk-mq if appropriate")
Signed-off-by: Jun'ichi Nomura <3576fcbd7ffa3776a92ac17fc90ba38e23f75e95@ce.jp.nec.com>
Signed-off-by: Mike Snitzer <85e533f2e78486213c4d69f71462342ec0c62734@redhat.com>

--- drivers/md/dm-table.c
+++ drivers/md/dm-table.c
@@ -820,6 +820,12 @@
 }
 EXPORT_SYMBOL(dm_consume_args);

+static bool __table_type_request_based(unsigned table_type)
+{
+	return (table_type == DM_TYPE_REQUEST_BASED ||
+		table_type == DM_TYPE_MQ_REQUEST_BASED);
+}
+
 static int dm_table_set_type(struct dm_table *t)
 {
 	unsigned i;
@@ -852,8 +858,7 @@
 		 * Determine the type from the live device.
 		 * Default to bio-based if device is new.
 		 */
-		if (live_md_type == DM_TYPE_REQUEST_BASED ||
-		    live_md_type == DM_TYPE_MQ_REQUEST_BASED)
+		if (__table_type_request_based(live_md_type))
 			request_based = 1;
 		else
 			bio_based = 1;
@@ -903,7 +908,7 @@
 			}
 		t->type = DM_TYPE_MQ_REQUEST_BASED;

-	} else if (hybrid && list_empty(devices) && live_md_type != DM_TYPE_NONE) {
+	} else if (list_empty(devices) && __table_type_request_based(live_md_type)) {
 		/* inherit live MD type */
 		t->type = live_md_type;

@@ -925,10 +930,7 @@

 bool dm_table_request_based(struct dm_table *t)
 {
-	unsigned table_type = dm_table_get_type(t);
-
-	return (table_type == DM_TYPE_REQUEST_BASED ||
-		table_type == DM_TYPE_MQ_REQUEST_BASED);
+	return __table_type_request_based(dm_table_get_type(t));
 }

 bool dm_table_mq_request_based(struct dm_table *t)


zap commented out bit of code

zap commented out bit of code

--- Modules/_csv.c
+++ Modules/_csv.c
@@ -7,7 +7,7 @@
 module instead.

 **** For people modifying this code, please note that as of this writing
-**** (2003-03-23), it is intended that this code should work with Python
+**** (2003-03-23), it is intended t hat this code should work with Python
 **** 2.2.

 */
@@ -270,7 +270,6 @@
 Dialect_dealloc(DialectObj *self)
 {
         Py_XDECREF(self->lineterminator);
-	/*PyMem_DEL(self);*/
         self->ob_type->tp_free((PyObject *)self);
 }


dm table: fall back to getting device using name_to_dev_t()

If a device is used as the root filesystem, it can't be built
off of devices which are within the root filesystem (just like
command line arguments to root=).  For this reason, Linux has a
pseudo-filesystem for root= and MD initialization (based on the
function name_to_dev_t) which handles different ways of specifying
devices including PARTUUID and major:minor.

Switch to using name_to_dev_t() in dm_get_device().  Rather than
having DM assume that all things which are not major:minor are paths in
an already-mounted filesystem, change dm_get_device() to first attempt
to look up the device in the filesystem, and if not found it will fall
back to using name_to_dev_t().

In terms of backwards compatibility, there are some cases where
behavior will be different:
- If you have a file in the current working directory named 1:2 and
  you initialze DM there, then it will try to use that file rather
  than the disk with that major:minor pair as a backing device.
- Similarly for other bdev types which name_to_dev_t() knows how to
  interpret, the previous behavior was to repeatedly check for the
  existence of the file (e.g., while waiting for rootfs to come up)
  but the new behavior is to use the name_to_dev_t() interpretation.
  For example, if you have a file named /dev/ubiblock0_0 which is
  a symlink to /dev/sda3, but it is not yet present when DM starts
  to initialize, then the name_to_dev_t() interpretation will take
  precedence.

These incompatibilities would only show up in really strange setups
with bad practices so we shouldn't have to worry about them.

Signed-off-by: Dan Ehrenberg <7651083733dec1b497ee3fb7d4e25811aa64d643@chromium.org>
Signed-off-by: Mike Snitzer <85e533f2e78486213c4d69f71462342ec0c62734@redhat.com>

--- drivers/md/dm-table.c
+++ drivers/md/dm-table.c
@@ -19,6 +19,7 @@
 #include <linux/delay.h>
 #include <linux/atomic.h>
 #include <linux/blk-mq.h>
+#include <linux/mount.h>

 #define DM_MSG_PREFIX "table"

@@ -373,23 +374,18 @@
 	int r;
 	dev_t uninitialized_var(dev);
 	struct dm_dev_internal *dd;
-	unsigned int major, minor;
 	struct dm_table *t = ti->table;
-	char dummy;
+	struct block_device *bdev;

 	BUG_ON(!t);

-	if (sscanf(path, "%u:%u%c", &major, &minor, &dummy) == 2) {
-		/* Extract the major/minor numbers */
-		dev = MKDEV(major, minor);
-		if (MAJOR(dev) != major || MINOR(dev) != minor)
-			return -EOVERFLOW;
+	/* convert the path to a device */
+	bdev = lookup_bdev(path);
+	if (IS_ERR(bdev)) {
+		dev = name_to_dev_t(path);
+		if (!dev)
+			return -ENODEV;
 	} else {
-		/* convert the path to a device */
-		struct block_device *bdev = lookup_bdev(path);
-
-		if (IS_ERR(bdev))
-			return PTR_ERR(bdev);
 		dev = bdev->bd_dev;
 		bdput(bdev);
 	}


[MTD] Auto-load mtdchar module when device opened.

The mtdchar module is missing the char-major-90-* alias that would cause
it to be auto-loaded when a device of that type is opened.  This patch
adds the alia..

Signed-off-by: Scott James Remnant <625600233cb3bcab32268c17610882e0fdaed295@canonical.com>
Signed-off-by: Tim Gardner <c65a040f7f664378353fb65fc3553df208a14f68@canonical.com>
Signed-off-by: David Woodhouse <b460d66aaf00c296a3db1c1d9eeafc081d5f7d70@intel.com>

--- drivers/mtd/mtdchar.c
+++ drivers/mtd/mtdchar.c
@@ -825,3 +825,4 @@
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
 MODULE_DESCRIPTION("Direct character-device access to MTD devices");
+MODULE_ALIAS_CHARDEV_MAJOR(MTD_CHAR_MAJOR);


mtd: fix partition wrapper functions

mtd: fix partition wrapper functions

This patch reverts a change that may have been mistakenly included with the set
of patches that introduced the new mtd api entry functions.  Or perhaps I am
mistaken :)

The problem is in the partition wrapper functions, where the calls to the driver
methods were replaced with calls to the new mtd api functions.  This causes the
api function to be called a second time, further down the call stack.  This is
not only unnecessary and redundant - because the sanity checking code and (more
restrictive) bounds checks for the partition were done in the first call - but
is potentially problematic and confusing.

For example, the call stack for a call to mtd_read() on a partitioned device
currently looks like this:

mtd_read()             gets struct mtd_info for the partition
|
+-> part_read()        via the pointer assigned when the partition was created
    |
    +->mtd_read()      this time gets struct mtd_info for the master
       |
       +->xyz_driver_read()  via the pointer asigned by the driver

It seems that this can cause a variety of problems.  For example, if you want to
add code to the api function that tests a value in mtd_info that is relevant
only to the partition.  Or (in my case) you want the driver to return a value
that may be different from that returned by the mtd api function.

This patch eliminates the second call to the mtd api function.  It was tested on
the docg4 nand driver with a subset of the api functions, but I inspected the
rest and don't see any problems.

Signed-off-by: Mike Dunn <fb45650607d5d3b86ae56096b614fca93138244e@newsguy.com>
Signed-off-by: Artem Bityutskiy <2f96f8cd3e2780a209d0ab27d1b44624d0019d3f@linux.intel.com>
Signed-off-by: David Woodhouse <b460d66aaf00c296a3db1c1d9eeafc081d5f7d70@intel.com>

--- drivers/mtd/mtdpart.c
+++ drivers/mtd/mtdpart.c
@@ -65,7 +65,8 @@
 	int res;

 	stats = part->master->ecc_stats;
-	res = mtd_read(part->master, from + part->offset, len, retlen, buf);
+	res = part->master->_read(part->master, from + part->offset, len,
+				  retlen, buf);
 	if (unlikely(res)) {
 		if (mtd_is_bitflip(res))
 			mtd->ecc_stats.corrected += part->master->ecc_stats.corrected - stats.corrected;
@@ -80,15 +81,15 @@
 {
 	struct mtd_part *part = PART(mtd);

-	return mtd_point(part->master, from + part->offset, len, retlen,
-			 virt, phys);
+	return part->master->_point(part->master, from + part->offset, len,
+				    retlen, virt, phys);
 }

 static int part_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
 {
 	struct mtd_part *part = PART(mtd);

-	return mtd_unpoint(part->master, from + part->offset, len);
+	return part->master->_unpoint(part->master, from + part->offset, len);
 }

 static unsigned long part_get_unmapped_area(struct mtd_info *mtd,
@@ -99,7 +100,8 @@
 	struct mtd_part *part = PART(mtd);

 	offset += part->offset;
-	return mtd_get_unmapped_area(part->master, len, offset, flags);
+	return part->master->_get_unmapped_area(part->master, len, offset,
+						flags);
 }

 static int part_read_oob(struct mtd_info *mtd, loff_t from,
@@ -130,7 +132,7 @@
 			return -EINVAL;
 	}

-	res = mtd_read_oob(part->master, from + part->offset, ops);
+	res = part->master->_read_oob(part->master, from + part->offset, ops);
 	if (unlikely(res)) {
 		if (mtd_is_bitflip(res))
 			mtd->ecc_stats.corrected++;
@@ -144,43 +146,46 @@
 		size_t len, size_t *retlen, u_char *buf)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_read_user_prot_reg(part->master, from, len, retlen, buf);
+	return part->master->_read_user_prot_reg(part->master, from, len,
+						 retlen, buf);
 }

 static int part_get_user_prot_info(struct mtd_info *mtd,
 		struct otp_info *buf, size_t len)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_get_user_prot_info(part->master, buf, len);
+	return part->master->_get_user_prot_info(part->master, buf, len);
 }

 static int part_read_fact_prot_reg(struct mtd_info *mtd, loff_t from,
 		size_t len, size_t *retlen, u_char *buf)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_read_fact_prot_reg(part->master, from, len, retlen, buf);
+	return part->master->_read_fact_prot_reg(part->master, from, len,
+						 retlen, buf);
 }

 static int part_get_fact_prot_info(struct mtd_info *mtd, struct otp_info *buf,
 		size_t len)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_get_fact_prot_info(part->master, buf, len);
+	return part->master->_get_fact_prot_info(part->master, buf, len);
 }

 static int part_write(struct mtd_info *mtd, loff_t to, size_t len,
 		size_t *retlen, const u_char *buf)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_write(part->master, to + part->offset, len, retlen, buf);
+	return part->master->_write(part->master, to + part->offset, len,
+				    retlen, buf);
 }

 static int part_panic_write(struct mtd_info *mtd, loff_t to, size_t len,
 		size_t *retlen, const u_char *buf)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_panic_write(part->master, to + part->offset, len, retlen,
-			       buf);
+	return part->master->_panic_write(part->master, to + part->offset, len,
+					  retlen, buf);
 }

 static int part_write_oob(struct mtd_info *mtd, loff_t to,
@@ -192,29 +197,30 @@
 		return -EINVAL;
 	if (ops->datbuf && to + ops->len > mtd->size)
 		return -EINVAL;
-	return mtd_write_oob(part->master, to + part->offset, ops);
+	return part->master->_write_oob(part->master, to + part->offset, ops);
 }

 static int part_write_user_prot_reg(struct mtd_info *mtd, loff_t from,
 		size_t len, size_t *retlen, u_char *buf)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_write_user_prot_reg(part->master, from, len, retlen, buf);
+	return part->master->_write_user_prot_reg(part->master, from, len,
+						  retlen, buf);
 }

 static int part_lock_user_prot_reg(struct mtd_info *mtd, loff_t from,
 		size_t len)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_lock_user_prot_reg(part->master, from, len);
+	return part->master->_lock_user_prot_reg(part->master, from, len);
 }

 static int part_writev(struct mtd_info *mtd, const struct kvec *vecs,
 		unsigned long count, loff_t to, size_t *retlen)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_writev(part->master, vecs, count, to + part->offset,
-			  retlen);
+	return part->master->_writev(part->master, vecs, count,
+				     to + part->offset, retlen);
 }

 static int part_erase(struct mtd_info *mtd, struct erase_info *instr)
@@ -223,7 +229,7 @@
 	int ret;

 	instr->addr += part->offset;
-	ret = mtd_erase(part->master, instr);
+	ret = part->master->_erase(part->master, instr);
 	if (ret) {
 		if (instr->fail_addr != MTD_FAIL_ADDR_UNKNOWN)
 			instr->fail_addr -= part->offset;
@@ -249,44 +255,44 @@
 static int part_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_lock(part->master, ofs + part->offset, len);
+	return part->master->_lock(part->master, ofs + part->offset, len);
 }

 static int part_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_unlock(part->master, ofs + part->offset, len);
+	return part->master->_unlock(part->master, ofs + part->offset, len);
 }

 static int part_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_is_locked(part->master, ofs + part->offset, len);
+	return part->master->_is_locked(part->master, ofs + part->offset, len);
 }

 static void part_sync(struct mtd_info *mtd)
 {
 	struct mtd_part *part = PART(mtd);
-	mtd_sync(part->master);
+	part->master->_sync(part->master);
 }

 static int part_suspend(struct mtd_info *mtd)
 {
 	struct mtd_part *part = PART(mtd);
-	return mtd_suspend(part->master);
+	return part->master->_suspend(part->master);
 }

 static void part_resume(struct mtd_info *mtd)
 {
 	struct mtd_part *part = PART(mtd);
-	mtd_resume(part->master);
+	part->master->_resume(part->master);
 }

 static int part_block_isbad(struct mtd_info *mtd, loff_t ofs)
 {
 	struct mtd_part *part = PART(mtd);
 	ofs += part->offset;
-	return mtd_block_isbad(part->master, ofs);
+	return part->master->_block_isbad(part->master, ofs);
 }

 static int part_block_markbad(struct mtd_info *mtd, loff_t ofs)
@@ -295,7 +301,7 @@
 	int res;

 	ofs += part->offset;
-	res = mtd_block_markbad(part->master, ofs);
+	res = part->master->_block_markbad(part->master, ofs);
 	if (!res)
 		mtd->ecc_stats.badblocks++;
 	return res;


UBI: block: Use ENOSYS as return value when CONFIG_UBIBLOCK=n

In order to have a way of distinguishing an invalid ioctl from a
not supported (but otherwise valid) ioctl, this commit changes the
return value of the ioctl stubs from ENOTTY to ENOSYS.

This will be useful to report more accurate error messages from
userspace tools.

Signed-off-by: Ezequiel Garcia <7248f52d8926fd82a5eb079a13afe9dd79e34c7a@free-electrons.com>
Signed-off-by: Artem Bityutskiy <2f96f8cd3e2780a209d0ab27d1b44624d0019d3f@linux.intel.com>

--- drivers/mtd/ubi/ubi.h
+++ drivers/mtd/ubi/ubi.h
@@ -875,11 +875,11 @@
 static inline void ubiblock_exit(void) {}
 static inline int ubiblock_create(struct ubi_volume_info *vi)
 {
-	return -ENOTTY;
+	return -ENOSYS;
 }
 static inline int ubiblock_remove(struct ubi_volume_info *vi)
 {
-	return -ENOTTY;
+	return -ENOSYS;
 }
 #endif


Added code to use incoming bssrdf params (disabled) + comments.

--- src/appleseed/renderer/kernel/lighting/pathtracer.h
+++ src/appleseed/renderer/kernel/lighting/pathtracer.h
@@ -337,8 +337,6 @@
         SubsurfaceSampleVisitor subsurf_visitor;
         if (vertex.m_bssrdf)
         {
-            // todo: handle OSL bump mapping here.
-
             // Find possible incoming points.
             const SubsurfaceSampler sampler(shading_context);
             sampler.sample(
@@ -359,10 +357,45 @@
             vertex.m_incoming_point = &subsurf_visitor.m_incoming_points[i];
             vertex.m_incoming_point_prob = subsurf_visitor.m_probabilities[i] / subsurf_visitor.m_sample_count;

-            // todo:
-            //     exec the OSL shader at the incoming point if needed.
-            //     eval the bssrdf at incoming point.
-            //     apply OSL bump.
+            // Here, when tracing rays from the camera we should "jump" to the sampled
+            // point, which is the point the light arrives to, evaluate the bssrdf there
+            // and use the bssrdf parameters for the following lighting calculations.
+            // This has the side effect of blurring the textures used in bssrdfs and makes
+            // it impossible to have detailed textures for highly translucent materials.
+            // It's probably not what most users want, so we use the bssrdf parameters
+            // at the outgoing point for lighting calculations.
+            // Maybe this could be exposed as an option later.
+            //
+            // Interesting reference:
+            //
+            //   http://renderman.pixar.com/resources/current/RenderMan/subsurface.html#varying-albedo-and-diffuse-mean-free-path-length
+            //   section 2.6: Where to apply the surface albedo
+#if 0
+            if (!Adjoint)
+            {
+                if (material->has_osl_surface())
+                {
+                    shading_context.execute_osl_subsurface(
+                        *material->get_osl_surface(),
+                        *vertex.m_incoming_point);
+                }
+
+                vertex.m_bssrdf->evaluate_inputs(
+                    shading_context,
+                    bssrdf_input_evaluator,
+                    *vertex.m_incoming_point);
+
+                if (material->has_osl_surface())
+                {
+                    sampling_context.split_in_place(1, 1);
+                    const double s = sampling_context.next_double2();
+                    shading_context.choose_osl_subsurface_normal(
+                        *vertex.m_incoming_point,
+                        vertex.m_bssrdf_data,
+                        s);
+                }
+            }
+#endif
         }

         // Pass this vertex to the path visitor.


[PATCH] net, 8139too.c: fix netpoll deadlock

fix deadlock in the 8139too driver: poll handlers should never forcibly
enable local interrupts, because they might be used by netpoll/printk
from IRQ context.

  =================================
  [ INFO: inconsistent lock state ]
  2.6.19 #11
  ---------------------------------
  inconsistent {softirq-on-W} -> {in-softirq-W} usage.
  swapper/1 [HC0[0]:SC1[1]:HE1:SE0] takes:
   (&npinfo->poll_lock){-+..}, at: [<c0350a41>] net_rx_action+0x64/0x1de
  {softirq-on-W} state was registered at:
    [<c0134c86>] mark_lock+0x5b/0x39c
    [<c0135012>] mark_held_locks+0x4b/0x68
    [<c01351e9>] trace_hardirqs_on+0x115/0x139
    [<c02879e6>] rtl8139_poll+0x3d7/0x3f4
    [<c035c85d>] netpoll_poll+0x82/0x32f
    [<c035c775>] netpoll_send_skb+0xc9/0x12f
    [<c035cdcc>] netpoll_send_udp+0x253/0x25b
    [<c0288463>] write_msg+0x40/0x65
    [<c011cead>] __call_console_drivers+0x45/0x51
    [<c011cf16>] _call_console_drivers+0x5d/0x61
    [<c011d4fb>] release_console_sem+0x11f/0x1d8
    [<c011d7d7>] register_console+0x1ac/0x1b3
    [<c02883f8>] init_netconsole+0x55/0x67
    [<c010040c>] init+0x9a/0x24e
    [<c01049cf>] kernel_thread_helper+0x7/0x10
    [<ffffffff>] 0xffffffff
  irq event stamp: 819992
  hardirqs last  enabled at (819992): [<c0350a16>] net_rx_action+0x39/0x1de
  hardirqs last disabled at (819991): [<c0350b1e>] net_rx_action+0x141/0x1de
  softirqs last  enabled at (817552): [<c01214e4>] __do_softirq+0xa3/0xa8
  softirqs last disabled at (819987): [<c0106051>] do_softirq+0x5b/0xc9

  other info that might help us debug this:
  no locks held by swapper/1.

  stack backtrace:
   [<c0104d88>] dump_trace+0x63/0x1e8
   [<c0104f26>] show_trace_log_lvl+0x19/0x2e
   [<c010532d>] show_trace+0x12/0x14
   [<c0105343>] dump_stack+0x14/0x16
   [<c0134980>] print_usage_bug+0x23c/0x246
   [<c0134d33>] mark_lock+0x108/0x39c
   [<c01356a7>] __lock_acquire+0x361/0x9ed
   [<c0136018>] lock_acquire+0x56/0x72
   [<c03aff1f>] _spin_lock+0x35/0x42
   [<c0350a41>] net_rx_action+0x64/0x1de
   [<c0121493>] __do_softirq+0x52/0xa8
   [<c0106051>] do_softirq+0x5b/0xc9
   [<c0121338>] irq_exit+0x3c/0x48
   [<c0106163>] do_IRQ+0xa4/0xbd
   [<c01047c6>] common_interrupt+0x2e/0x34
   [<c011db92>] vprintk+0x2c0/0x309
   [<c011dbf6>] printk+0x1b/0x1d
   [<c01003f2>] init+0x80/0x24e
   [<c01049cf>] kernel_thread_helper+0x7/0x10
   =======================

Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>
Acked-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- drivers/net/8139too.c
+++ drivers/net/8139too.c
@@ -2131,14 +2131,15 @@
 	}

 	if (done) {
+		unsigned long flags;
 		/*
 		 * Order is important since data can get interrupted
 		 * again when we think we are done.
 		 */
-		local_irq_disable();
+		local_irq_save(flags);
 		RTL_W16_F(IntrMask, rtl8139_intr_mask);
 		__netif_rx_complete(dev);
-		local_irq_enable();
+		local_irq_restore(flags);
 	}
 	spin_unlock(&tp->rx_lock);


erts: Verify correct node name in erts_internal:new_connection()

--- erts/emulator/beam/dist.c
+++ erts/emulator/beam/dist.c
@@ -5054,7 +5054,7 @@
     Eterm* hp;
     Eterm dhandle;

-    if (is_not_atom(BIF_ARG_1)) {
+    if (!is_node_name_atom(BIF_ARG_1)) {
 	BIF_ERROR(BIF_P, BADARG);
     }
     dep = erts_find_or_insert_dist_entry(BIF_ARG_1);


can: only send bitrate data via netlink when available

When setting the bitrate both can_calc_bittiming() and can_fixup_bittiming()
lead to the bitrate variable to be set, when a proper bit timing is available.
Only then the bitrate configuration is stored for the device, so checking for
priv->bittiming.bitrate is always sufficient.

Signed-off-by: Oliver Hartkopp <06a38fb2ed1a2d0a17f4f06761ac2e5ace5a31ab@hartkopp.net>
Acked-by: Stephane Grosjean <6c81a7e275706687a5edcbeeec7ded4a5dcad6c5@peak-system.com>
Signed-off-by: Marc Kleine-Budde <4a0ea1158d3cc63151119c05b1bff00c0bdbf421@pengutronix.de>

--- drivers/net/can/dev.c
+++ drivers/net/can/dev.c
@@ -606,7 +606,7 @@
 {
 	struct can_priv *priv = netdev_priv(dev);

-	if (!priv->bittiming.tq && !priv->bittiming.bitrate) {
+	if (!priv->bittiming.bitrate) {
 		netdev_err(dev, "bit-timing not yet defined\n");
 		return -EINVAL;
 	}
@@ -719,7 +719,8 @@
 	struct can_priv *priv = netdev_priv(dev);
 	size_t size = 0;

-	size += nla_total_size(sizeof(struct can_bittiming));	/* IFLA_CAN_BITTIMING */
+	if (priv->bittiming.bitrate)				/* IFLA_CAN_BITTIMING */
+		size += nla_total_size(sizeof(struct can_bittiming));
 	if (priv->bittiming_const)				/* IFLA_CAN_BITTIMING_CONST */
 		size += nla_total_size(sizeof(struct can_bittiming_const));
 	size += nla_total_size(sizeof(struct can_clock));	/* IFLA_CAN_CLOCK */
@@ -741,8 +742,9 @@

 	if (priv->do_get_state)
 		priv->do_get_state(dev, &state);
-	if (nla_put(skb, IFLA_CAN_BITTIMING,
-		    sizeof(priv->bittiming), &priv->bittiming) ||
+	if ((priv->bittiming.bitrate &&
+	     nla_put(skb, IFLA_CAN_BITTIMING,
+		     sizeof(priv->bittiming), &priv->bittiming)) ||
 	    (priv->bittiming_const &&
 	     nla_put(skb, IFLA_CAN_BITTIMING_CONST,
 		     sizeof(*priv->bittiming_const), priv->bittiming_const)) ||


added some attribute support, and fail() now working.

--- gass/transfer/source/library/globus_gass_transfer_ftp.c
+++ gass/transfer/source/library/globus_gass_transfer_ftp.c
@@ -50,12 +50,12 @@
 #define debug_printf(a)
 #endif

-static volatile int globus_l_gass_transfer_ftp_closing;
+static volatile int globus_l_gass_transfer_ftp_open_connections;
 #if !defined(GLOBUS_GASS_TRANSFER_FTP_PARSER_TEST)
 int
 globus_l_gass_transfer_ftp_activate(void)
 {
-    globus_l_gass_transfer_ftp_closing = 0;
+    globus_l_gass_transfer_ftp_open_connections = 0;

     globus_module_activate(GLOBUS_COMMON_MODULE);
     globus_module_activate(GLOBUS_FTP_CLIENT_MODULE);
@@ -72,14 +72,16 @@
 int
 globus_l_gass_transfer_ftp_deactivate(void)
 {
+
     globus_l_gass_transfer_ftp_lock();
-    while(globus_l_gass_transfer_ftp_closing > 0)
+
+    while(globus_l_gass_transfer_ftp_open_connections > 0)
     {
 	globus_l_gass_transfer_ftp_wait();
     }
     globus_l_gass_transfer_ftp_unlock();
-    /*  globus_libc_fprintf(stderr, "LIB: about to call: globus_module_deactivate(GLOBUS_FTP_CLIENT_MODULE)\n"); */
-   globus_module_deactivate(GLOBUS_FTP_CLIENT_MODULE);
+
+    globus_module_deactivate(GLOBUS_FTP_CLIENT_MODULE);

     globus_mutex_destroy(&globus_l_gass_transfer_ftp_mutex);
     globus_cond_destroy(&globus_l_gass_transfer_ftp_cond);
@@ -87,7 +89,7 @@
     globus_free(globus_l_gass_transfer_ftp_subject_name);
     */
     globus_module_deactivate(GLOBUS_COMMON_MODULE);
-/*    globus_libc_fprintf(stderr, "LIB:  transfer_ftp_deactivate returning\n"); */
+
     return GLOBUS_SUCCESS;
 }
 globus_module_descriptor_t globus_i_gass_transfer_ftp_module =
@@ -191,6 +193,8 @@
 	globus_l_gass_transfer_ftp_unlock();
 	return;
     }
+    else /* there was an error trying to register a write, need to close up */
+      globus_l_gass_transfer_ftp_register_close(new_proto);

   fail_exit:
     /* Registration failed, closing up the handle and signaling failure to GASS */
@@ -248,6 +252,7 @@
     if(result != GLOBUS_SUCCESS)
     {
 	/* FIX - there was an error, do something about it */
+      globus_l_gass_transfer_ftp_register_close(new_proto);
     }

     globus_l_gass_transfer_ftp_unlock();
@@ -282,24 +287,17 @@
 	switch(new_proto->state)
 	{
 	  case GLOBUS_GASS_TRANSFER_FTP_STATE_PENDING:
-	    if(new_proto->oneshot_registered == GLOBUS_TRUE)
+	    new_proto->failure_occurred = GLOBUS_TRUE;
+	    while(new_proto->state ==
+		  GLOBUS_GASS_TRANSFER_FTP_STATE_PENDING)
 	    {
-		new_proto->failure_occurred = GLOBUS_TRUE;
-		signalled = GLOBUS_TRUE;
-
-		break;
+	      globus_l_gass_transfer_ftp_wait();
 	    }
-	    else if(new_proto->oneshot_active)
-	    {
-		new_proto->failure_occurred = GLOBUS_TRUE;
-		while(new_proto->state ==
-		      GLOBUS_GASS_TRANSFER_FTP_STATE_PENDING)
-		{
-		    globus_l_gass_transfer_ftp_wait();
-		}
-		break;
-	    }
+	    break;
+
+	    /*
           case GLOBUS_GASS_TRANSFER_FTP_STATE_CONNECTING:
+	    */
           case GLOBUS_GASS_TRANSFER_FTP_STATE_IDLE:
 	    /* We will transition to the closing state, signalling the failure,
 	     * and registering the close (which will transition us to the
@@ -313,10 +311,13 @@

           case GLOBUS_GASS_TRANSFER_FTP_STATE_CLOSING:
           case GLOBUS_GASS_TRANSFER_FTP_STATE_DONE:
+	    /*  the rest of these states don't exist */
+	    /*
           case GLOBUS_GASS_TRANSFER_FTP_STATE_REQUESTING:
           case GLOBUS_GASS_TRANSFER_FTP_STATE_RESPONDING:
           case GLOBUS_GASS_TRANSFER_FTP_STATE_REFERRED:
           case GLOBUS_GASS_TRANSFER_FTP_STATE_DENIED:
+	    */
 	    signalled = GLOBUS_TRUE;
 	    new_proto->failure_occurred = GLOBUS_TRUE;
 	    break;
@@ -367,6 +368,7 @@
 	last_data = proto->last_data;

+	globus_l_gass_transfer_ftp_signal();
 	globus_l_gass_transfer_ftp_unlock();
 	if(!last_data)
 	    globus_gass_transfer_proto_send_complete(request,
@@ -412,7 +414,6 @@
     if(eof)
     {
 	proto->eof_read = GLOBUS_TRUE;
-	/*printf("ftp_read_callback: EOF read, signal complete in the get_done_callback\n"); */
     }

     if(error)
@@ -425,6 +426,9 @@

     /* Register the socket for closing if we're done reading from it */
     /*  FIX - ftp doesn't require a close, but leave this code here for the time being  */
+    /*  if there was an error, the ftp_get_done_callback will take care of calling close
+     */
+    /*
     if(proto->recv_state == GLOBUS_GASS_TRANSFER_FTP_RECV_STATE_EOF ||
        proto->recv_state == GLOBUS_GASS_TRANSFER_FTP_RECV_STATE_ERROR)
     {
@@ -433,7 +437,7 @@
 		globus_l_gass_transfer_ftp_register_close(proto);
 	    }
     }
-
+    */

     {
 	globus_gass_transfer_request_t		request;
@@ -461,6 +465,7 @@
 	l_offset = proto->user_offset;
 	request = proto->request;

+	globus_l_gass_transfer_ftp_signal();
 	globus_l_gass_transfer_ftp_unlock();

 	if(!last_data)
@@ -524,15 +529,15 @@
 globus_l_gass_transfer_ftp_close(
     globus_gass_transfer_ftp_request_proto_t *		proto)
 {
+
     proto->state = GLOBUS_GASS_TRANSFER_FTP_STATE_DONE;

     if(proto->destroy_called)
     {
 	globus_l_gass_transfer_ftp_proto_destroy(proto);
     }
-    globus_l_gass_transfer_ftp_closing--;
-/*printf("ftp_close: closing= %d\n", globus_l_gass_transfer_ftp_closing); */
-
+
+    globus_l_gass_transfer_ftp_open_connections--;
     globus_l_gass_transfer_ftp_signal();
 }
 /* globus_l_gass_transfer_ftp_close() */
@@ -556,16 +561,24 @@

     proto->state = GLOBUS_GASS_TRANSFER_FTP_STATE_CLOSING;

-    globus_l_gass_transfer_ftp_closing++;
+    /*  globus_l_gass_transfer_ftp_closing++; */
 /*printf("ftp_register_close: closing= %d\n", globus_l_gass_transfer_ftp_closing); */

-/*   FIX - not sure if this is right, should only abort when fail is called by the user -  actually, just call abort in the fail function
+/*   FIX - not sure if this is right, should only abort when fail is called by the user -  actually, just call abort in the fail function
+     actually, i changed my mind, in the case where send or receive_bytes returns something other than SUCCESS, we want to
+     abort as well.
     if(proto->failure_occurred)
-	result = globus_ftp_client_abort(&proto->handle);
-	*/
-    if(result == GLOBUS_SUCCESS)
-    {
+*/
+    result = globus_ftp_client_abort(&proto->handle);
+
+    if(result != GLOBUS_SUCCESS)
+    {
+      /*
+      globus_libc_fprintf(stderr, "in _ftp_register_close(), _ftp_client_abort() returned something other than GLOBUS_SUCCESS");
+      */
+      /*  not sure if this should get called here
 	globus_l_gass_transfer_ftp_close(proto);
+      */
     }
 }
 /* globus_l_gass_transfer_ftp_register_close() */
@@ -613,10 +626,7 @@
     new_proto = (globus_gass_transfer_ftp_request_proto_t *) proto;

     globus_l_gass_transfer_ftp_lock();
-    if(new_proto->state == GLOBUS_GASS_TRANSFER_FTP_STATE_CLOSING ||
-       new_proto->state == GLOBUS_GASS_TRANSFER_FTP_STATE_REFERRED ||
-       new_proto->state == GLOBUS_GASS_TRANSFER_FTP_STATE_RESPONDING ||
-       new_proto->state == GLOBUS_GASS_TRANSFER_FTP_STATE_DENIED)
+    if(new_proto->state == GLOBUS_GASS_TRANSFER_FTP_STATE_CLOSING)
     {
 	new_proto->destroy_called=GLOBUS_TRUE;
     }
@@ -634,10 +644,7 @@
 globus_l_gass_transfer_ftp_proto_destroy(
     globus_gass_transfer_ftp_request_proto_t *		proto)
 {
-    if(proto->response_buffer != GLOBUS_NULL)
-    {
-	globus_free(proto->response_buffer);
-    }
+
     if(proto->reason != GLOBUS_NULL)
     {
 	globus_free(proto->reason);
@@ -646,21 +653,7 @@
     {
 	globus_url_destroy(&proto->url);
     }
-    else
-    {
-	if(proto->method)
-	{
-	    globus_free(proto->method);
-	}
-	if(proto->uri)
-	{
-	    globus_free(proto->uri);
-	}
-    }
-/*
-    globus_i_gass_transfer_keyvalue_destroy(
-	&proto->headers);
-*/
+
     globus_ftp_client_handle_destroy(&proto->handle);
     globus_free(proto);
 }
@@ -685,6 +678,7 @@
     int						rc=GLOBUS_SUCCESS;
     globus_gass_transfer_file_mode_t		file_mode=GLOBUS_GASS_TRANSFER_FILE_MODE_BINARY;
     globus_ftp_client_attr_t			ftp_attr;
+    globus_ftp_control_tcpbuffer_t              tcp_buffer;
     globus_result_t				result;
     globus_gass_transfer_ftp_request_proto_t *	proto;
     int						sndbuf;
@@ -723,21 +717,22 @@
 	goto handle_error;
     }

-#if 0 /* skipping attributes stuff for now */
+#if 1 /* NOT skipping attributes stuff for now */

     if(*attr != GLOBUS_NULL)
     {
 	/* Check attributes we care about */
-	globus_gass_transfer_requestattr_get_proxy_url(attr,
-						       &proxy);
-
+      /*	globus_gass_transfer_requestattr_get_proxy_url(attr,
+		&proxy);
+      */
 	rc = globus_gass_transfer_requestattr_get_socket_sndbuf(
 	    attr,
 	    &sndbuf);
 	if(rc != GLOBUS_SUCCESS)
 	{
-	    goto tcpattr_error;
+	    goto attr_error;
 	}
+	/*
 	else
 	{
 	    if(sndbuf != 0)
@@ -746,14 +741,16 @@
 						 sndbuf);
 	    }
 	}
-
+	*/
+
 	rc = globus_gass_transfer_requestattr_get_socket_rcvbuf(
 	    attr,
 	    &rcvbuf);
 	if(rc != GLOBUS_SUCCESS)
 	{
-	    goto tcpattr_error;
+	    goto attr_error;
 	}
+	/*
 	else
 	{
 	    if(rcvbuf != 0)
@@ -762,7 +759,8 @@
 						 rcvbuf);
 	    }
 	}
-
+	*/
+	/*
 	rc = globus_gass_transfer_requestattr_get_socket_nodelay(
 	    attr,
 	    &nodelay);
@@ -775,22 +773,30 @@
 	    globus_io_attr_set_tcp_nodelay(&tcp_attr,
 					   nodelay);
 	}
-
+	*/
+
 	/* File mode is important on Windows */
 	rc = globus_gass_transfer_requestattr_get_file_mode(attr,
 							    &file_mode);
 	if(rc != GLOBUS_SUCCESS)
 	{
-	    goto tcpattr_error;
+	    goto attr_error;
 	}
+	if(file_mode == GLOBUS_GASS_TRANSFER_FILE_MODE_TEXT)
+	{
+	  globus_ftp_client_attr_set_type(&ftp_attr,
+					  GLOBUS_FTP_CONTROL_TYPE_ASCII);
+	}
+	/*
 	rc = globus_gass_transfer_requestattr_get_block_size(attr,
 							     &proto->block_size);
 	if(rc != GLOBUS_SUCCESS)
 	{
 	    goto tcpattr_error;
 	}
-    }
-#endif /* skipping attribute stuff for now */
+	*/
+    }
+#endif /* NOT skipping attribute stuff for now */

     proto->url_string = globus_gass_transfer_request_get_url(request);

@@ -810,92 +816,43 @@
 	goto url_error;
     }

-#if 0 /* skipping attribute stuff for now */
-
-    /* If gsiftp, set security attributes of TCP handle */
-    if(strcmp(proto->url.scheme, "gsiftp")== 0)
-    {
-	globus_io_secure_authorization_data_t	data;
-	globus_gass_transfer_authorization_t	mode;
-	char *					subject;
-	globus_result_t				result;
-
-
-	globus_io_secure_authorization_data_initialize(&data);
-	result = globus_io_attr_set_secure_authentication_mode(
-	    &tcp_attr,
-	    GLOBUS_IO_SECURE_AUTHENTICATION_MODE_GSSAPI,
-	    GLOBUS_NULL);
-
-	if(result != GLOBUS_SUCCESS)
-	{
-	    goto url_error;
-	}
-	result = globus_io_attr_set_secure_channel_mode(
-	    &tcp_attr,
-	    GLOBUS_IO_SECURE_CHANNEL_MODE_SSL_WRAP);
-	if(result != GLOBUS_SUCCESS)
-	{
-	    goto url_error;
-	}
+#if 1 /* NOT skipping attribute stuff for now */
+    {
+      globus_gass_transfer_authorization_t	mode;
+      char *					subject=NULL;
+      globus_result_t				result;
+
+    /* If gsiftp, set security subject attribute of TCP handle */
+      if(strcmp(proto->url.scheme, "gsiftp")== 0)
+      {
+
 	if(*attr != GLOBUS_NULL)
 	{
-	    rc = globus_gass_transfer_secure_requestattr_get_authorization(
-		attr,
-		&mode,
-		&subject);
-	    if(rc != GLOBUS_SUCCESS)
-	    {
-		goto url_error;
-	    }
+	  rc = globus_gass_transfer_secure_requestattr_get_authorization(
+									 attr,
+									 &mode,
+									 &subject);
+	  if(rc != GLOBUS_SUCCESS)
+	  {
+	    goto url_error;
+	  }
 	}
-	else
-	{
-	    mode = GLOBUS_GASS_TRANSFER_AUTHORIZE_SELF;
-	}
-
-	switch(mode)
-	{
-	  case GLOBUS_GASS_TRANSFER_AUTHORIZE_SELF:
-	    globus_io_attr_set_secure_authorization_mode(
-		&tcp_attr,
-		GLOBUS_IO_SECURE_AUTHORIZATION_MODE_SELF,
-		GLOBUS_NULL);
-	    break;
-	  case GLOBUS_GASS_TRANSFER_AUTHORIZE_HOST:
-	    subject = globus_malloc(strlen(proto->url.host) +
-				     strlen("/CN=")
-				     +1);
-	    sprintf(subject,
-		    "/CN=%s",
-		    proto->url.host);
-
-	    globus_io_secure_authorization_data_set_identity(
-		&data,
-		subject);
-	    globus_io_attr_set_secure_authorization_mode(
-		&tcp_attr,
-		GLOBUS_IO_SECURE_AUTHORIZATION_MODE_IDENTITY,
-		&data);
-	    globus_io_secure_authorization_data_destroy(&data);
-	    globus_free(subject);
-	    break;
-	  case GLOBUS_GASS_TRANSFER_AUTHORIZE_SUBJECT:
-	    globus_io_secure_authorization_data_set_identity(
-		&data,
-		subject);
-	    globus_io_attr_set_secure_authorization_mode(
-		&tcp_attr,
-		GLOBUS_IO_SECURE_AUTHORIZATION_MODE_IDENTITY,
-		&data);
-	    globus_io_secure_authorization_data_destroy(&data);
-	    break;
-	  case GLOBUS_GASS_TRANSFER_AUTHORIZE_CALLBACK:
-	    globus_assert(mode != GLOBUS_GASS_TRANSFER_AUTHORIZE_CALLBACK);
-	    goto url_error;
-	}
-    }
-#endif /* skipping attribute stuff for now */
+
+      }
+
+      if( proto->url.user     ||
+	  proto->url.password ||
+	  subject )
+      {
+	globus_ftp_client_attr_set_authorization(
+						 &ftp_attr,
+						 proto->url.user,
+						 proto->url.password,
+						 NULL,
+						 subject);
+      }
+    }
+#endif /* NOT skipping attribute stuff for now */

     if(proto == GLOBUS_NULL)
     {
@@ -942,8 +899,15 @@
     switch(proto->type)
     {
     case GLOBUS_GASS_TRANSFER_REQUEST_TYPE_PUT:
-
-	result = globus_ftp_client_put(
+      if(sndbuf !=0)
+      {
+	tcp_buffer.mode = GLOBUS_FTP_CONTROL_TCPBUFFER_FIXED;
+	tcp_buffer.fixed.size = sndbuf;
+	globus_ftp_client_attr_set_tcp_buffer(&ftp_attr,
+					      &tcp_buffer);
+      }
+
+      result = globus_ftp_client_put(
 	    &proto->handle,
 	    proto->url_string,
 	    &ftp_attr,
@@ -958,7 +922,14 @@
 	break;

     case GLOBUS_GASS_TRANSFER_REQUEST_TYPE_GET:
-
+      if(rcvbuf !=0)
+      {
+	tcp_buffer.mode = GLOBUS_FTP_CONTROL_TCPBUFFER_FIXED;
+	tcp_buffer.fixed.size = rcvbuf;
+	globus_ftp_client_attr_set_tcp_buffer(&ftp_attr,
+					      &tcp_buffer);
+      }
+
 	result = globus_ftp_client_get(
 	    &proto->handle,
 	    proto->url_string,
@@ -978,6 +949,7 @@
     }
     /* Success! */
     proto->state = GLOBUS_GASS_TRANSFER_FTP_STATE_IDLE;
+    globus_l_gass_transfer_ftp_open_connections++;
     globus_gass_transfer_proto_request_ready(
 	proto->request,
 	(globus_gass_transfer_request_proto_t *) proto);
@@ -1073,18 +1045,20 @@
     globus_gass_transfer_ftp_request_proto_t * proto;
     globus_bool_t                              failure = GLOBUS_FALSE;

-    /*   printf("get_done_callback: we should signal complete\n"); */
-
+
     if(error)
 	failure = GLOBUS_TRUE;

     proto = (globus_gass_transfer_ftp_request_proto_t *) callback_arg;
-
-    globus_gass_transfer_proto_receive_complete(proto->request,
-						proto->user_buffer,
-						proto->user_offset,
-						failure,
-						GLOBUS_TRUE);
+
+    if(!failure)
+      globus_gass_transfer_proto_receive_complete(proto->request,
+						  proto->user_buffer,
+						  proto->user_offset,
+						  failure,
+						  GLOBUS_TRUE);
+    globus_l_gass_transfer_ftp_close(proto);
+
 } /*globus_l_gass_transfer_ftp_get_done_callback() */

 void
@@ -1096,18 +1070,40 @@
     globus_gass_transfer_ftp_request_proto_t * proto;
     globus_bool_t                              failure = GLOBUS_FALSE;

-    /*  printf("put_done_callback: we should signal complete\n"); */
     if(error)
 	failure = GLOBUS_TRUE;
-
+
     proto = (globus_gass_transfer_ftp_request_proto_t *) callback_arg;
-
-    globus_gass_transfer_proto_send_complete(proto->request,
-						proto->user_buffer,
-						proto->user_offset,
-						failure,
-						GLOBUS_TRUE);
+
+    if(!failure)
+    {
+      globus_gass_transfer_proto_send_complete(proto->request,
+					       proto->user_buffer,
+					       proto->user_offset,
+					       failure,
+					       GLOBUS_TRUE);
+    }
+
+    globus_l_gass_transfer_ftp_close(proto);
+
 } /* globus_l_gass_transfer_ftp_put_done_callback() */

+static
+globus_bool_t
+globus_l_gass_transfer_ftp_callback_denied(
+    globus_abstime_t *                          time_stop,
+    void *					arg)
+{
+    globus_gass_transfer_request_t		request;
+
+    request = (globus_gass_transfer_request_t) arg;
+
+    globus_gass_transfer_proto_request_denied(
+	request,
+	GLOBUS_L_DEFAULT_FAILURE_CODE,
+	globus_libc_strdup(GLOBUS_L_DEFAULT_FAILURE_REASON));
+
+    return GLOBUS_TRUE;
+}

 #endif /* !parser only */


git-svn-id: svn+ssh://astrometry.net/svn/trunk/src/astrometry@8554 03a3cea6-2c03-0410-ac9b-9271b1c66c29

--- blind/test_scriptutils.c
+++ blind/test_scriptutils.c
@@ -4,15 +4,6 @@
 #include "cutest.h"
 #include "scriptutils.h"
 #include "bl.h"
-
-/*
- static void assertListsEqual(CuTest* tc, il* expect, il* lst) {
- int i;
- CuAssertIntEquals(tc, il_size(expect), il_size(lst));
- for (i=0; i<il_size(expect); i++)
- CuAssertIntEquals(tc, il_get(expect, i), il_get(lst, i));
- }
- */

 static void assertListEquals(CuTest* tc, int* expect, int N, il* lst) {
     int i;


can: dev: avoid calling kfree_skb() from interrupt context

ikfree_skb() is Called in can_free_echo_skb(), which might be called from (TX
Error) interrupt, which triggers the folloing warning:

[ 1153.360705] ------------[ cut here ]------------
[ 1153.360715] WARNING: CPU: 0 PID: 31 at net/core/skbuff.c:563 skb_release_head_state+0xb9/0xd0()
[ 1153.360772] Call Trace:
[ 1153.360778]  [<c167906f>] dump_stack+0x41/0x52
[ 1153.360782]  [<c105bb7e>] warn_slowpath_common+0x7e/0xa0
[ 1153.360784]  [<c158b909>] ? skb_release_head_state+0xb9/0xd0
[ 1153.360786]  [<c158b909>] ? skb_release_head_state+0xb9/0xd0
[ 1153.360788]  [<c105bc42>] warn_slowpath_null+0x22/0x30
[ 1153.360791]  [<c158b909>] skb_release_head_state+0xb9/0xd0
[ 1153.360793]  [<c158be90>] skb_release_all+0x10/0x30
[ 1153.360795]  [<c158bf06>] kfree_skb+0x36/0x80
[ 1153.360799]  [<f8486938>] ? can_free_echo_skb+0x28/0x40 [can_dev]
[ 1153.360802]  [<f8486938>] can_free_echo_skb+0x28/0x40 [can_dev]
[ 1153.360805]  [<f849a12c>] esd_pci402_interrupt+0x34c/0x57a [esd402]
[ 1153.360809]  [<c10a75b5>] handle_irq_event_percpu+0x35/0x180
[ 1153.360811]  [<c10a7623>] ? handle_irq_event_percpu+0xa3/0x180
[ 1153.360813]  [<c10a7731>] handle_irq_event+0x31/0x50
[ 1153.360816]  [<c10a9c7f>] handle_fasteoi_irq+0x6f/0x120
[ 1153.360818]  [<c10a9c10>] ? handle_edge_irq+0x110/0x110
[ 1153.360822]  [<c1011b61>] handle_irq+0x71/0x90
[ 1153.360823]  <IRQ>  [<c168152c>] do_IRQ+0x3c/0xd0
[ 1153.360829]  [<c1680b6c>] common_interrupt+0x2c/0x34
[ 1153.360834]  [<c107d277>] ? finish_task_switch+0x47/0xf0
[ 1153.360836]  [<c167c27b>] __schedule+0x35b/0x7e0
[ 1153.360839]  [<c10a5334>] ? console_unlock+0x2c4/0x4d0
[ 1153.360842]  [<c13df500>] ? n_tty_receive_buf_common+0x890/0x890
[ 1153.360845]  [<c10707b6>] ? process_one_work+0x196/0x370
[ 1153.360847]  [<c167c723>] schedule+0x23/0x60
[ 1153.360849]  [<c1070de1>] worker_thread+0x161/0x460
[ 1153.360852]  [<c1090fcf>] ? __wake_up_locked+0x1f/0x30
[ 1153.360854]  [<c1070c80>] ? rescuer_thread+0x2f0/0x2f0
[ 1153.360856]  [<c1074f01>] kthread+0xa1/0xc0
[ 1153.360859]  [<c1680401>] ret_from_kernel_thread+0x21/0x30
[ 1153.360861]  [<c1074e60>] ? kthread_create_on_node+0x110/0x110
[ 1153.360863] ---[ end trace 5ff83639cbb74b35 ]---

This patch replaces the kfree_skb() by dev_kfree_skb_any().

Signed-off-by: Thomas Körper <54fd90e8245dcac7de9c498103324cdce6388993@esd.eu>
Cc: linux-stable <4fbacc2fa0ffdbb11bf1ad6925b886ebd08dd15f@vger.kernel.org>
Signed-off-by: Marc Kleine-Budde <4a0ea1158d3cc63151119c05b1bff00c0bdbf421@pengutronix.de>

--- drivers/net/can/dev.c
+++ drivers/net/can/dev.c
@@ -382,7 +382,7 @@
 	BUG_ON(idx >= priv->echo_skb_max);

 	if (priv->echo_skb[idx]) {
-		kfree_skb(priv->echo_skb[idx]);
+		dev_kfree_skb_any(priv->echo_skb[idx]);
 		priv->echo_skb[idx] = NULL;
 	}
 }


add c extension

add c extension

--- karlooper/utils/encryption.c
+++ karlooper/utils/encryption.c
@@ -31,13 +31,13 @@
     int i;
     for (i = 0; i < first_length; ++i) {
         int encrypt = (int)input[i] + flag;
-        if (encrypt > 126) encrypt = encrypt - 126 + 32;
+        if (encrypt > 126) encrypt = encrypt - 126 + 38;
         result[i] = (char)(encrypt);
     }
     int j;
     for (j = first_length; j < str_length; ++j) {
         int encrypt = (int)key[j-first_length] + flag;
-        if (encrypt > 126) encrypt = encrypt - 126 + 32;
+        if (encrypt > 126) encrypt = encrypt - 126 + 38;
         result[j] = (char)(encrypt);
     }
     result[str_length] = '\0';
@@ -53,7 +53,7 @@
     int i;
     for (i = 0; i < input_length; ++i) {
         int decrypt = (int)input[i] - flag;
-        if (decrypt < 32) decrypt = decrypt + 126 - 32;
+        if (decrypt < 38) decrypt = decrypt + 126 - 38;
         result[i] = (char)(decrypt);
     }
     result[value_length] = '\0';


[PATCH] netdrvr: Convert cassini to pci_iomap

Folks,

This patch (against 2.6.17-rc1) converts the cassini driver to the
pci_iomap API that will do the right thing, so architectures like
PARISC can stop screaming about illegal usage of ioremap() on
non-cacheable regions.

Tested on 64bit PARISC kernel.

Signed-off-by: Marc Zyngier <f0ee73f698464d9b24960cfd983e278ecc504ba8@misterjones.org>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/net/cassini.c
+++ drivers/net/cassini.c
@@ -4877,7 +4877,7 @@
 				  const struct pci_device_id *ent)
 {
 	static int cas_version_printed = 0;
-	unsigned long casreg_base, casreg_len;
+	unsigned long casreg_len;
 	struct net_device *dev;
 	struct cas *cp;
 	int i, err, pci_using_dac;
@@ -4972,7 +4972,6 @@
 		pci_using_dac = 0;
 	}

-	casreg_base = pci_resource_start(pdev, 0);
 	casreg_len = pci_resource_len(pdev, 0);

 	cp = netdev_priv(dev);
@@ -5024,7 +5023,7 @@
 	cp->timer_ticks = 0;

 	/* give us access to cassini registers */
-	cp->regs = ioremap(casreg_base, casreg_len);
+	cp->regs = pci_iomap(pdev, 0, casreg_len);
 	if (cp->regs == 0UL) {
 		printk(KERN_ERR PFX "Cannot map device registers, "
 		       "aborting.\n");
@@ -5123,7 +5122,7 @@
 		cas_shutdown(cp);
 	mutex_unlock(&cp->pm_mutex);

-	iounmap(cp->regs);
+	pci_iounmap(pdev, cp->regs);

 err_out_free_res:
@@ -5171,7 +5170,7 @@
 #endif
 	pci_free_consistent(pdev, sizeof(struct cas_init_block),
 			    cp->init_block, cp->block_dvma);
-	iounmap(cp->regs);
+	pci_iounmap(pdev, cp->regs);
 	free_netdev(dev);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);


Don't compile dynamicoverlay when there is no POSIX shared memory support on the system. Use VLC_UNUSED() iso (void)().

--- modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c
+++ modules/video_filter/dynamicoverlay/dynamicoverlay_commands.c
@@ -34,7 +34,10 @@

 #include <string.h>
 #include <ctype.h>
+
+#if defined(HAVE_SYS_SHM_H)
 #include <sys/shm.h>
+#endif

 #include "dynamicoverlay.h"

@@ -154,7 +157,7 @@
 static int parser_Id( char *psz_command, char *psz_end,
                       commandparams_t *p_params )
 {
-    (void)(psz_end);
+    VLC_UNUSED(psz_end);
     skip_space( &psz_command );
     if( isdigit( *psz_command ) )
     {
@@ -167,16 +170,16 @@
 static int parser_None( char *psz_command, char *psz_end,
                         commandparams_t *p_params )
 {
-    (void)(psz_command);
-    (void)(psz_end);
-    (void)(p_params);
+    VLC_UNUSED(psz_command);
+    VLC_UNUSED(psz_end);
+    VLC_UNUSED(p_params);
     return VLC_SUCCESS;
 }

 static int parser_SetAlpha( char *psz_command, char *psz_end,
                             commandparams_t *p_params )
 {
-    (void)(psz_end);
+    VLC_UNUSED(psz_end);
     skip_space( &psz_command );
     if( isdigit( *psz_command ) )
     {
@@ -195,7 +198,7 @@
 static int parser_SetPosition( char *psz_command, char *psz_end,
                                commandparams_t *p_params )
 {
-    (void)(psz_end);
+    VLC_UNUSED(psz_end);
     skip_space( &psz_command );
     if( isdigit( *psz_command ) )
     {
@@ -220,7 +223,7 @@
 static int parser_SetTextAlpha( char *psz_command, char *psz_end,
                                 commandparams_t *p_params )
 {
-    (void)(psz_end);
+    VLC_UNUSED(psz_end);
     skip_space( &psz_command );
     if( isdigit( *psz_command ) )
     {
@@ -240,7 +243,7 @@
                                 commandparams_t *p_params )
 {
     int r, g, b;
-    (void)(psz_end);
+    VLC_UNUSED(psz_end);
     skip_space( &psz_command );
     if( isdigit( *psz_command ) )
     {
@@ -272,7 +275,7 @@
 static int parser_SetTextSize( char *psz_command, char *psz_end,
                                commandparams_t *p_params )
 {
-    (void)(psz_end);
+    VLC_UNUSED(psz_end);
     skip_space( &psz_command );
     if( isdigit( *psz_command ) )
     {
@@ -291,7 +294,7 @@
 static int parser_SetVisibility( char *psz_command, char *psz_end,
                                  commandparams_t *p_params )
 {
-    (void)(psz_end);
+    VLC_UNUSED(psz_end);
     skip_space( &psz_command );
     if( isdigit( *psz_command ) )
     {
@@ -316,7 +319,7 @@
 static int unparse_default( const commandparams_t *p_results,
                             buffer_t *p_output )
 {
-    (void)(p_results);
+    VLC_UNUSED(p_results);
     VLC_UNUSED(p_output);
     return VLC_SUCCESS;
 }
@@ -410,12 +413,13 @@
                                const commandparams_t *p_params,
                                commandparams_t *p_results )
 {
+#if defined(HAVE_SYS_SHM_H)
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
     struct shmid_ds shminfo;
     overlay_t *p_ovl;
     size_t i_size;

-    (void)(p_results);
+    VLC_UNUSED(p_results);

     p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
     if( p_ovl == NULL )
@@ -470,7 +474,6 @@
             p_ovl->data.p_text = NULL;
             return VLC_ENOMEM;
         }
-
         memcpy( p_ovl->data.p_text, p_data, p_params->i_width );

         shmdt( p_data );
@@ -482,10 +485,7 @@

         p_ovl->data.p_pic = malloc( sizeof( picture_t ) );
         if( p_ovl->data.p_pic == NULL )
-        {
-            msg_Err( p_filter, "Unable to allocate picture structure" );
             return VLC_ENOMEM;
-        }

         vout_InitFormat( &p_ovl->format, p_params->fourcc,
                          p_params->i_width, p_params->i_height,
@@ -545,17 +545,23 @@
         }
         shmdt( p_data );
     }
-
     p_sys->b_updated = p_ovl->b_active;

     return VLC_SUCCESS;
+#else
+    VLC_UNUSED(p_params);
+    VLC_UNUSED(p_results);
+
+    msg_Err( p_filter, "system doesn't support shared memory" );
+    return VLC_EGENERIC;
+#endif
 }

 static int exec_DeleteImage( filter_t *p_filter,
                              const commandparams_t *p_params,
                              commandparams_t *p_results )
 {
-    (void)(p_results);
+    VLC_UNUSED(p_results);
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
     p_sys->b_updated = VLC_TRUE;

@@ -566,8 +572,8 @@
                            const commandparams_t *p_params,
                            commandparams_t *p_results )
 {
-    (void)(p_params);
-    (void)(p_results);
+    VLC_UNUSED(p_params);
+    VLC_UNUSED(p_results);
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
     QueueTransfer( &p_sys->pending, &p_sys->atomic );
     p_sys->b_atomic = VLC_FALSE;
@@ -578,7 +584,7 @@
                           const commandparams_t *p_params,
                           commandparams_t *p_results )
 {
-    (void)(p_params);
+    VLC_UNUSED(p_params);
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;

     overlay_t *p_ovl = OverlayCreate();
@@ -677,7 +683,7 @@
                           const commandparams_t *p_params,
                           commandparams_t *p_results )
 {
-    (void)(p_results);
+    VLC_UNUSED(p_results);
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;

     overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
@@ -693,7 +699,7 @@
                              const commandparams_t *p_params,
                              commandparams_t *p_results )
 {
-    (void)(p_results);
+    VLC_UNUSED(p_results);
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;

     overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
@@ -711,7 +717,7 @@
                               const commandparams_t *p_params,
                               commandparams_t *p_results )
 {
-    (void)(p_results);
+    VLC_UNUSED(p_results);
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;

     overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
@@ -727,7 +733,7 @@
                               const commandparams_t *p_params,
                               commandparams_t *p_results )
 {
-    (void)(p_results);
+    VLC_UNUSED(p_results);
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;

     overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
@@ -743,7 +749,7 @@
                               const commandparams_t *p_params,
                               commandparams_t *p_results )
 {
-    (void)(p_results);
+    VLC_UNUSED(p_results);
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;

     overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
@@ -759,7 +765,7 @@
                                const commandparams_t *p_params,
                                commandparams_t *p_results )
 {
-    (void)(p_results);
+    VLC_UNUSED(p_results);
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;

     overlay_t *p_ovl = ListGet( &p_sys->overlays, p_params->i_id );
@@ -776,8 +782,8 @@
                              commandparams_t *p_results )
 {
     filter_sys_t *p_sys = (filter_sys_t*) p_filter->p_sys;
-    (void)(p_params);
-    (void)(p_results);
+    VLC_UNUSED(p_params);
+    VLC_UNUSED(p_results);

     p_sys->b_atomic = VLC_TRUE;
     return VLC_SUCCESS;


gianfar: Fix frame size calculation when hardware VLAN acceleration is on

In gfar_change_mtu(), the frame size needs to be increased to account
for the extra 4 bytes VLAN adds to the ethernet header.  However,
it was being increased by the length of the whole header (18 bytes),
which is wrong.

Signed-off-by: Dai Haruki <ef83efe3060917be62e2acfec4eb7f58159fb5de@freescale.com>
Signed-off-by: Andy Fleming <761b620017597639866580fd234cedf470f42bc1@freescale.com>
Signed-off-by: Jeff Garzik <f3e731dfa293c7a83119d8aacfa41b5d2d780be9@garzik.org>

--- drivers/net/gianfar.c
+++ drivers/net/gianfar.c
@@ -1185,7 +1185,7 @@
 	int frame_size = new_mtu + ETH_HLEN;

 	if (priv->vlan_enable)
-		frame_size += VLAN_ETH_HLEN;
+		frame_size += VLAN_HLEN;

 	if (gfar_uses_fcb(priv))
 		frame_size += GMAC_FCB_LEN;


Removing extrapages of linked list when popping

--- src/page_list.c
+++ src/page_list.c
@@ -69,6 +69,10 @@
 	page->right_page = redislite_get_4bytes(&data[8]);
 	page->left_page = redislite_get_4bytes(&data[12]);
 	page->element_len = NULL; // in case the next alloc fails, we don't want to free this
+	if (page->element_alloced == 0) {
+		page->element = NULL;
+		return page;
+	}
 	page->element = redislite_malloc(sizeof(char *) * page->size);
 	if (page->element == NULL) {
 		goto cleanup;
@@ -406,6 +410,24 @@
 		list_page_num = list->right_page;
 		list = redislite_page_get(cs->db, cs, list->right_page, REDISLITE_PAGE_TYPE_LIST);
 	}
+
+	if (page->list->size == 0 && list_page_num == page->list->right_page && redislite_free_bytes(cs->db, list, REDISLITE_PAGE_TYPE_FIRST) > 0 && list->size > 0) {
+		for (i = 0; i < list->size; i++)
+			lpush(cs, page->list, list->element[list->size - i - 1], list->element_len[list->size - i - 1]);
+		page->list->right_page = list->right_page;
+		list->right_page = list->left_page = 0;
+		redislite_page_delete(_cs, list_page_num, REDISLITE_PAGE_TYPE_LIST);
+		list_page_num = page_num;
+
+		if (page->list->right_page > 0) {
+			list = redislite_page_get(cs->db, cs, page->list->right_page, REDISLITE_PAGE_TYPE_LIST);
+			list->left_page = page_num;
+			redislite_add_modified_page(cs, page->list->right_page, REDISLITE_PAGE_TYPE_LIST, list);
+		}
+		list = page->list;
+		// TODO: delete old page
+	}
+
 	*value = list->element[0];
 	*value_len = list->element_len[0];
 	for (i = 1; i < list->size; i++) {


gianfar: Fix oversized packets handling

gianfar: Fix oversized packets handling

Issuing the following command on host:

$ ifconfig eth2 mtu 1600 ; ping 10.0.0.27 -s 1485 -c 1

Makes some boards (tested with MPC8315 rev 1.1 and MPC8313 rev 1.0)
oops like this:

  skb_over_panic: text:c0195914 len:1537 put:1537 head:c79e4800 data:c79e4880 tail:0xc79e4e81 end:0xc79e4e80 dev:eth1
  ------------[ cut here ]------------
  kernel BUG at net/core/skbuff.c:127!
  Oops: Exception in kernel mode, sig: 5 [#1]
  MPC831x RDB
  last sysfs file: /sys/kernel/uevent_seqnum
  Modules linked in:
  NIP: c01c1840 LR: c01c1840 CTR: c016d918
  [...]
  NIP [c01c1840] skb_over_panic+0x48/0x5c
  LR [c01c1840] skb_over_panic+0x48/0x5c
  Call Trace:
  [c0339d50] [c01c1840] skb_over_panic+0x48/0x5c (unreliable)
  [c0339d60] [c01c3020] skb_put+0x5c/0x60
  [c0339d70] [c0195914] gfar_clean_rx_ring+0x25c/0x3d0
  [c0339dc0] [c01976e8] gfar_poll+0x170/0x1bc

Dumped buffer descriptors showed that eTSEC's length/truncation
logic sometimes passes oversized packets, i.e. for the above ICMP
packet the following two buffer descriptors may become ready:

  status=1400 length=1536
  status=1800 length=1541

So, it seems that gianfar actually receives the whole big frame,
and it tries to place the packet into two BDs. This situation
confuses the driver, and so the skb_put() sanity check fails.

This patch fixes the issue by adding an appropriate check, i.e.
the driver should not try to process frames with buffer
descriptor's length over rx_buffer_size (i.e. maxfrm and mrblr).

Note that sometimes eTSEC works correctly, i.e. in the second
(last) buffer descriptor bits 'truncated' and 'crcerr' are set,
and so there's no oops. Though I couldn't find any logic when
it works correctly and when not.

Signed-off-by: Anton Vorontsov <f72eea26502475052d15bdce621d2155da84f214@mvista.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/gianfar.c
+++ drivers/net/gianfar.c
@@ -2655,6 +2655,10 @@
 		dma_unmap_single(&priv->ofdev->dev, bdp->bufPtr,
 				priv->rx_buffer_size, DMA_FROM_DEVICE);

+		if (unlikely(!(bdp->status & RXBD_ERR) &&
+				bdp->length > priv->rx_buffer_size))
+			bdp->status = RXBD_LARGE;
+
 		/* We drop the frame if we failed to allocate a new buffer */
 		if (unlikely(!newskb || !(bdp->status & RXBD_LAST) ||
 				 bdp->status & RXBD_ERR)) {


Fix crash and remove test code

Fix crash and remove test code

--- src/redislite.c
+++ src/redislite.c
@@ -473,12 +473,12 @@
 #ifdef DEBUG
 	fseek(db->file, 0L, SEEK_END);
 	long size = ftell(db->file);
-/*
-	if (size < db->page_size * (num + 1)) {
-		redislite_free(data);
-		return NULL;
-	}
-*/
+	/*
+		if (size < db->page_size * (num + 1)) {
+			redislite_free(data);
+			return NULL;
+		}
+	*/
 #endif
 	i = fseek(db->file, (long)db->page_size * num, SEEK_SET);
 	if (i != 0) {


[PATCH] ibmveth fix failed addbuf

[PATCH] ibmveth fix failed addbuf

This patch fixes a bug that happens when the hypervisor can't add a
buffer.  The old code wrote IBM_VETH_INVALID_MAP into the free_map
array, so next time the index was used, a ibmveth_assert() caught it and
called BUG().  The patch writes the right value into the free_map array
so that the index can be reused.

Signed-off-by: Santiago Leon <86f027c664650e0500cbb9d175338bd9cd64795b@us.ibm.com>
Signed-off-by: Jeff Garzik <15f615bf7d20c2937c7eb5aa759110fd6768848c@pobox.com>

--- drivers/net/ibmveth.c
+++ drivers/net/ibmveth.c
@@ -237,7 +237,7 @@
 		lpar_rc = h_add_logical_lan_buffer(adapter->vdev->unit_address, desc.desc);

 		if(lpar_rc != H_Success) {
-			pool->free_map[free_index] = IBM_VETH_INVALID_MAP;
+			pool->free_map[free_index] = index;
 			pool->skbuff[index] = NULL;
 			pool->consumer_index--;
 			dma_unmap_single(&adapter->vdev->dev,


net: remove unused #include <linux/version.h>

Remove unused #include <linux/version.h>('s) in
  drivers/net/ksz884x.c

Signed-off-by: Huang Weiyi <3747a8217f9c255c8b609f0f2e71d2a8804c1b96@gmail.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/ksz884x.c
+++ drivers/net/ksz884x.c
@@ -19,7 +19,6 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/version.h>
 #include <linux/ioport.h>
 #include <linux/pci.h>
 #include <linux/proc_fs.h>


lxt PHY: Support for the buggy LXT973 rev A2

This patch adds proper handling of the buggy revision A2 of LXT973 phy, adding
precautions linked to ERRATA Item 4:

Revision A2 of LXT973 chip randomly returns the contents of the previous even
register when you read a odd register regularly

Signed-off-by: Christophe Leroy <4e2d3d12816ace76f1cfa36c1816509bd24cf089@c-s.fr>
Acked-by: Richard Cochran <e27030aebe9cad8817d34b8c31dbaf301fb798b9@gmail.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/phy/lxt.c
+++ drivers/net/phy/lxt.c
@@ -120,6 +120,123 @@
 		err = phy_write(phydev, MII_LXT971_IER, 0);

 	return err;
+}
+
+/*
+ * A2 version of LXT973 chip has an ERRATA: it randomly return the contents
+ * of the previous even register when you read a odd register regularly
+ */
+
+static int lxt973a2_update_link(struct phy_device *phydev)
+{
+	int status;
+	int control;
+	int retry = 8; /* we try 8 times */
+
+	/* Do a fake read */
+	status = phy_read(phydev, MII_BMSR);
+
+	if (status < 0)
+		return status;
+
+	control = phy_read(phydev, MII_BMCR);
+	if (control < 0)
+		return control;
+
+	do {
+		/* Read link and autonegotiation status */
+		status = phy_read(phydev, MII_BMSR);
+	} while (status >= 0 && retry-- && status == control);
+
+	if (status < 0)
+		return status;
+
+	if ((status & BMSR_LSTATUS) == 0)
+		phydev->link = 0;
+	else
+		phydev->link = 1;
+
+	return 0;
+}
+
+int lxt973a2_read_status(struct phy_device *phydev)
+{
+	int adv;
+	int err;
+	int lpa;
+	int lpagb = 0;
+
+	/* Update the link, but return if there was an error */
+	err = lxt973a2_update_link(phydev);
+	if (err)
+		return err;
+
+	if (AUTONEG_ENABLE == phydev->autoneg) {
+		int retry = 1;
+
+		adv = phy_read(phydev, MII_ADVERTISE);
+
+		if (adv < 0)
+			return adv;
+
+		do {
+			lpa = phy_read(phydev, MII_LPA);
+
+			if (lpa < 0)
+				return lpa;
+
+			/* If both registers are equal, it is suspect but not
+			* impossible, hence a new try
+			*/
+		} while (lpa == adv && retry--);
+
+		lpa &= adv;
+
+		phydev->speed = SPEED_10;
+		phydev->duplex = DUPLEX_HALF;
+		phydev->pause = phydev->asym_pause = 0;
+
+		if (lpagb & (LPA_1000FULL | LPA_1000HALF)) {
+			phydev->speed = SPEED_1000;
+
+			if (lpagb & LPA_1000FULL)
+				phydev->duplex = DUPLEX_FULL;
+		} else if (lpa & (LPA_100FULL | LPA_100HALF)) {
+			phydev->speed = SPEED_100;
+
+			if (lpa & LPA_100FULL)
+				phydev->duplex = DUPLEX_FULL;
+		} else {
+			if (lpa & LPA_10FULL)
+				phydev->duplex = DUPLEX_FULL;
+		}
+
+		if (phydev->duplex == DUPLEX_FULL) {
+			phydev->pause = lpa & LPA_PAUSE_CAP ? 1 : 0;
+			phydev->asym_pause = lpa & LPA_PAUSE_ASYM ? 1 : 0;
+		}
+	} else {
+		int bmcr = phy_read(phydev, MII_BMCR);
+
+		if (bmcr < 0)
+			return bmcr;
+
+		if (bmcr & BMCR_FULLDPLX)
+			phydev->duplex = DUPLEX_FULL;
+		else
+			phydev->duplex = DUPLEX_HALF;
+
+		if (bmcr & BMCR_SPEED1000)
+			phydev->speed = SPEED_1000;
+		else if (bmcr & BMCR_SPEED100)
+			phydev->speed = SPEED_100;
+		else
+			phydev->speed = SPEED_10;
+
+		phydev->pause = phydev->asym_pause = 0;
+	}
+
+	return 0;
 }

 static int lxt973_probe(struct phy_device *phydev)
@@ -175,6 +292,16 @@
 	.driver		= { .owner = THIS_MODULE,},
 }, {
 	.phy_id		= 0x00137a10,
+	.name		= "LXT973-A2",
+	.phy_id_mask	= 0xffffffff,
+	.features	= PHY_BASIC_FEATURES,
+	.flags		= 0,
+	.probe		= lxt973_probe,
+	.config_aneg	= lxt973_config_aneg,
+	.read_status	= lxt973a2_read_status,
+	.driver		= { .owner = THIS_MODULE,},
+}, {
+	.phy_id		= 0x00137a10,
 	.name		= "LXT973",
 	.phy_id_mask	= 0xfffffff0,
 	.features	= PHY_BASIC_FEATURES,


phylib: Fix delay argument of schedule_delayed_work

The commit a390d1f3 ("phylib: convert state_queue work to
delayed_work") missed converting 'expires' value to 'delay' value.

Signed-off-by: Atsushi Nemoto <80aeab2fcc576fb9134b563f36af765199d49e90@mba.ocn.ne.jp>
Acked-by: Marcin Slusarz <bc4bbf83189bf2aa3b4ae434673d425054bbfadd@gmail.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/phy/phy.c
+++ drivers/net/phy/phy.c
@@ -434,7 +434,7 @@
 	phydev->adjust_state = handler;

 	INIT_DELAYED_WORK(&phydev->state_queue, phy_state_machine);
-	schedule_delayed_work(&phydev->state_queue, jiffies + HZ);
+	schedule_delayed_work(&phydev->state_queue, HZ);
 }

 /**
@@ -946,6 +946,5 @@
 	if (err < 0)
 		phy_error(phydev);

-	schedule_delayed_work(&phydev->state_queue,
-				jiffies + PHY_STATE_TIME * HZ);
-}
+	schedule_delayed_work(&phydev->state_queue, PHY_STATE_TIME * HZ);
+}


sfc: Rework efx_set_multicast_hash()

sfc: Rework efx_set_multicast_hash()

When !port_enabled, defer the write to reconfigure_mac_wrapper.

Whilst here, simplify the logic now that efx_start_port() always calls
efx_reconfigure_port().

From: Steve Hodgson <eb20a6615749cf04ff61aa37e18f749ed6d01446@solarflare.com>
Signed-off-by: Ben Hutchings <0672176982fbc629cc374f31a7a45ae1671abf90@solarflare.com>
Signed-off-by: Jeff Garzik <15f615bf7d20c2937c7eb5aa759110fd6768848c@redhat.com>

--- drivers/net/sfc/efx.c
+++ drivers/net/sfc/efx.c
@@ -560,6 +560,12 @@
 	EFX_LOG(efx, "reconfiguring MAC from PHY settings on CPU %d\n",
 		raw_smp_processor_id());

+	/* Serialise the promiscuous flag with efx_set_multicast_list. */
+	if (efx_dev_registered(efx)) {
+		netif_addr_lock_bh(efx->net_dev);
+		netif_addr_unlock_bh(efx->net_dev);
+	}
+
 	falcon_reconfigure_xmac(efx);

 	/* Inform kernel of loss/gain of carrier */
@@ -1410,26 +1416,19 @@
 	return 0;
 }

-/* Context: netif_tx_lock held, BHs disabled. */
+/* Context: netif_addr_lock held, BHs disabled. */
 static void efx_set_multicast_list(struct net_device *net_dev)
 {
 	struct efx_nic *efx = netdev_priv(net_dev);
 	struct dev_mc_list *mc_list = net_dev->mc_list;
 	union efx_multicast_hash *mc_hash = &efx->multicast_hash;
-	bool promiscuous;
+	bool promiscuous = !!(net_dev->flags & IFF_PROMISC);
+	bool changed = (efx->promiscuous != promiscuous);
 	u32 crc;
 	int bit;
 	int i;

-	/* Set per-MAC promiscuity flag and reconfigure MAC if necessary */
-	promiscuous = !!(net_dev->flags & IFF_PROMISC);
-	if (efx->promiscuous != promiscuous) {
-		efx->promiscuous = promiscuous;
-		/* Close the window between efx_stop_port() and efx_flush_all()
-		 * by only queuing work when the port is enabled. */
-		if (efx->port_enabled)
-			queue_work(efx->workqueue, &efx->reconfigure_work);
-	}
+	efx->promiscuous = promiscuous;

 	/* Build multicast hash table */
 	if (promiscuous || (net_dev->flags & IFF_ALLMULTI)) {
@@ -1443,6 +1442,13 @@
 			mc_list = mc_list->next;
 		}
 	}
+
+	if (!efx->port_enabled)
+		/* Delay pushing settings until efx_start_port() */
+		return;
+
+	if (changed)
+		queue_work(efx->workqueue, &efx->reconfigure_work);

 	/* Create and activate new global multicast hash table */
 	falcon_set_multicast_hash(efx);


locktorture: Cleanup header usage

locktorture: Cleanup header usage

Remove some unnecessary ones and explicitly include rwsem.h

Signed-off-by: Davidlohr Bueso <004a7ec0459a12f8239e6a658beae4a155e8573d@suse.de>
Signed-off-by: Paul E. McKenney <1e0ce936bb9b355d257bf5790d2513c3f28be22b@linux.vnet.ibm.com>

--- kernel/locking/locktorture.c
+++ kernel/locking/locktorture.c
@@ -20,32 +20,20 @@
  * Author: Paul E. McKenney <paulmck@us.ibm.com>
  *	Based on kernel/rcu/torture.c.
  */
-#include <linux/types.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kthread.h>
-#include <linux/err.h>
 #include <linux/spinlock.h>
 #include <linux/rwlock.h>
 #include <linux/mutex.h>
+#include <linux/rwsem.h>
 #include <linux/smp.h>
 #include <linux/interrupt.h>
 #include <linux/sched.h>
 #include <linux/atomic.h>
-#include <linux/bitops.h>
-#include <linux/completion.h>
 #include <linux/moduleparam.h>
-#include <linux/percpu.h>
-#include <linux/notifier.h>
-#include <linux/reboot.h>
-#include <linux/freezer.h>
-#include <linux/cpu.h>
 #include <linux/delay.h>
-#include <linux/stat.h>
 #include <linux/slab.h>
-#include <linux/trace_clock.h>
-#include <asm/byteorder.h>
 #include <linux/torture.h>

 MODULE_LICENSE("GPL");


sfc: Survive ISR0=0 bug in the shared IRQ case

Signed-off-by: Ben Hutchings <0672176982fbc629cc374f31a7a45ae1671abf90@solarflare.com>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>

--- drivers/net/sfc/nic.c
+++ drivers/net/sfc/nic.c
@@ -1384,6 +1384,15 @@
 		efx->last_irq_cpu = raw_smp_processor_id();
 		EFX_TRACE(efx, "IRQ %d on CPU %d status " EFX_DWORD_FMT "\n",
 			  irq, raw_smp_processor_id(), EFX_DWORD_VAL(reg));
+	} else if (EFX_WORKAROUND_15783(efx)) {
+		/* We can't return IRQ_HANDLED more than once on seeing ISR0=0
+		 * because this might be a shared interrupt, but we do need to
+		 * check the channel every time and preemptively rearm it if
+		 * it's idle. */
+		efx_for_each_channel(channel, efx) {
+			if (!channel->work_pending)
+				efx_nic_eventq_read_ack(channel);
+		}
 	}

 	return result;


pwm: imx: Remove enabled field from struct imx_chip

We can test PWMF_ENABLED bit to know if pwm is enabled or not.
Thus remove enabled field from struct imx_chip.

Signed-off-by: Axel Lin <b6ffd6973e972cb999e8e535ab74da7fee0c035f@ingics.com>
Acked-by: Sascha Hauer <c00cbc2b736c26791a3822db86f8796fe9efff67@pengutronix.de>
Signed-off-by: Thierry Reding <b75a4d02013b0e68ae2c6bb0dcfd4b7bec282dc9@avionic-design.de>

--- drivers/pwm/pwm-imx.c
+++ drivers/pwm/pwm-imx.c
@@ -43,7 +43,6 @@
 	struct clk	*clk_per;
 	struct clk	*clk_ipg;

-	int		enabled;
 	void __iomem	*mmio_base;

 	struct pwm_chip	chip;
@@ -135,7 +134,7 @@
 		MX3_PWMCR_DOZEEN | MX3_PWMCR_WAITEN |
 		MX3_PWMCR_DBGEN | MX3_PWMCR_CLKSRC_IPG_HIGH;

-	if (imx->enabled)
+	if (test_bit(PWMF_ENABLED, &pwm->flags))
 		cr |= MX3_PWMCR_EN;

 	writel(cr, imx->mmio_base + MX3_PWMCR);
@@ -186,8 +185,6 @@

 	imx->set_enable(chip, true);

-	imx->enabled = 1;
-
 	return 0;
 }

@@ -198,7 +195,6 @@
 	imx->set_enable(chip, false);

 	clk_disable_unprepare(imx->clk_per);
-	imx->enabled = 0;
 }

 static struct pwm_ops imx_pwm_ops = {


GESTrackObject: Add convenience macros for accessing properties

--- ges/ges-track-object.h
+++ ges/ges-track-object.h
@@ -44,6 +44,38 @@

 #define GES_TRACK_OBJECT_GET_CLASS(obj) \
   (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TRACK_OBJECT, GESTrackObjectClass))
+
+/**
+ * GES_TRACK_OBJECT_START:
+ * @obj: a #GESTrackObject
+ *
+ * The start position of the object (in nanoseconds).
+ */
+#define GES_TRACK_OBJECT_START(obj) (((GESTrackObject*)obj)->start)
+
+/**
+ * GES_TRACK_OBJECT_INPOINT:
+ * @obj: a #GESTrackObject
+ *
+ * The in-point of the object (in nanoseconds).
+ */
+#define GES_TRACK_OBJECT_INPOINT(obj) (((GESTrackObject*)obj)->inpoint)
+
+/**
+ * GES_TRACK_OBJECT_DURATION:
+ * @obj: a #GESTrackObject
+ *
+ * The duration position of the object (in nanoseconds).
+ */
+#define GES_TRACK_OBJECT_DURATION(obj) (((GESTrackObject*)obj)->duration)
+
+/**
+ * GES_TRACK_OBJECT_PRIORITY:
+ * @obj: a #GESTrackObject
+ *
+ * The priority of the object (in nanoseconds).
+ */
+#define GES_TRACK_OBJECT_PRIORITY(obj) (((GESTrackObject*)obj)->priority)

 /**
  * GESTrackObject:


in2000: switch to ->show_info()

in2000: switch to ->show_info()

Signed-off-by: Al Viro <de609eb4d5d70b1d38ec6642adbfc33a2781f63c@zeniv.linux.org.uk>

--- drivers/scsi/in2000.c
+++ drivers/scsi/in2000.c
@@ -2166,152 +2166,117 @@
 }

-static int in2000_proc_info(struct Scsi_Host *instance, char *buf, char **start, off_t off, int len, int in)
+static int in2000_write_info(struct Scsi_Host *instance, char *buf, int len)
 {

 #ifdef PROC_INTERFACE

 	char *bp;
-	char tbuf[128];
+	struct IN2000_hostdata *hd;
+	int x, i;
+
+	hd = (struct IN2000_hostdata *) instance->hostdata;
+
+	buf[len] = '\0';
+	bp = buf;
+	if (!strncmp(bp, "debug:", 6)) {
+		bp += 6;
+		hd->args = simple_strtoul(bp, NULL, 0) & DB_MASK;
+	} else if (!strncmp(bp, "disconnect:", 11)) {
+		bp += 11;
+		x = simple_strtoul(bp, NULL, 0);
+		if (x < DIS_NEVER || x > DIS_ALWAYS)
+			x = DIS_ADAPTIVE;
+		hd->disconnect = x;
+	} else if (!strncmp(bp, "period:", 7)) {
+		bp += 7;
+		x = simple_strtoul(bp, NULL, 0);
+		hd->default_sx_per = sx_table[round_period((unsigned int) x)].period_ns;
+	} else if (!strncmp(bp, "resync:", 7)) {
+		bp += 7;
+		x = simple_strtoul(bp, NULL, 0);
+		for (i = 0; i < 7; i++)
+			if (x & (1 << i))
+				hd->sync_stat[i] = SS_UNSET;
+	} else if (!strncmp(bp, "proc:", 5)) {
+		bp += 5;
+		hd->proc = simple_strtoul(bp, NULL, 0);
+	} else if (!strncmp(bp, "level2:", 7)) {
+		bp += 7;
+		hd->level2 = simple_strtoul(bp, NULL, 0);
+	}
+#endif
+	return len;
+}
+
+static int in2000_show_info(struct seq_file *m, struct Scsi_Host *instance)
+{
+
+#ifdef PROC_INTERFACE
 	unsigned long flags;
 	struct IN2000_hostdata *hd;
 	Scsi_Cmnd *cmd;
-	int x, i;
-	static int stop = 0;
+	int x;

 	hd = (struct IN2000_hostdata *) instance->hostdata;

-/* If 'in' is TRUE we need to _read_ the proc file. We accept the following
- * keywords (same format as command-line, but only ONE per read):
- *    debug
- *    disconnect
- *    period
- *    resync
- *    proc
- */
-
-	if (in) {
-		buf[len] = '\0';
-		bp = buf;
-		if (!strncmp(bp, "debug:", 6)) {
-			bp += 6;
-			hd->args = simple_strtoul(bp, NULL, 0) & DB_MASK;
-		} else if (!strncmp(bp, "disconnect:", 11)) {
-			bp += 11;
-			x = simple_strtoul(bp, NULL, 0);
-			if (x < DIS_NEVER || x > DIS_ALWAYS)
-				x = DIS_ADAPTIVE;
-			hd->disconnect = x;
-		} else if (!strncmp(bp, "period:", 7)) {
-			bp += 7;
-			x = simple_strtoul(bp, NULL, 0);
-			hd->default_sx_per = sx_table[round_period((unsigned int) x)].period_ns;
-		} else if (!strncmp(bp, "resync:", 7)) {
-			bp += 7;
-			x = simple_strtoul(bp, NULL, 0);
-			for (i = 0; i < 7; i++)
-				if (x & (1 << i))
-					hd->sync_stat[i] = SS_UNSET;
-		} else if (!strncmp(bp, "proc:", 5)) {
-			bp += 5;
-			hd->proc = simple_strtoul(bp, NULL, 0);
-		} else if (!strncmp(bp, "level2:", 7)) {
-			bp += 7;
-			hd->level2 = simple_strtoul(bp, NULL, 0);
-		}
-		return len;
-	}
-
 	spin_lock_irqsave(instance->host_lock, flags);
-	bp = buf;
-	*bp = '\0';
-	if (hd->proc & PR_VERSION) {
-		sprintf(tbuf, "\nVersion %s - %s.", IN2000_VERSION, IN2000_DATE);
-		strcat(bp, tbuf);
-	}
+	if (hd->proc & PR_VERSION)
+		seq_printf(m, "\nVersion %s - %s.", IN2000_VERSION, IN2000_DATE);
+
 	if (hd->proc & PR_INFO) {
-		sprintf(tbuf, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No");
-		strcat(bp, tbuf);
-		strcat(bp, "\nsync_xfer[] =       ");
-		for (x = 0; x < 7; x++) {
-			sprintf(tbuf, "\t%02x", hd->sync_xfer[x]);
-			strcat(bp, tbuf);
-		}
-		strcat(bp, "\nsync_stat[] =       ");
-		for (x = 0; x < 7; x++) {
-			sprintf(tbuf, "\t%02x", hd->sync_stat[x]);
-			strcat(bp, tbuf);
-		}
+		seq_printf(m, "\ndip_switch=%02x: irq=%d io=%02x floppy=%s sync/DOS5=%s", (hd->dip_switch & 0x7f), instance->irq, hd->io_base, (hd->dip_switch & 0x40) ? "Yes" : "No", (hd->dip_switch & 0x20) ? "Yes" : "No");
+		seq_printf(m, "\nsync_xfer[] =       ");
+		for (x = 0; x < 7; x++)
+			seq_printf(m, "\t%02x", hd->sync_xfer[x]);
+		seq_printf(m, "\nsync_stat[] =       ");
+		for (x = 0; x < 7; x++)
+			seq_printf(m, "\t%02x", hd->sync_stat[x]);
 	}
 #ifdef PROC_STATISTICS
 	if (hd->proc & PR_STATISTICS) {
-		strcat(bp, "\ncommands issued:    ");
-		for (x = 0; x < 7; x++) {
-			sprintf(tbuf, "\t%ld", hd->cmd_cnt[x]);
-			strcat(bp, tbuf);
-		}
-		strcat(bp, "\ndisconnects allowed:");
-		for (x = 0; x < 7; x++) {
-			sprintf(tbuf, "\t%ld", hd->disc_allowed_cnt[x]);
-			strcat(bp, tbuf);
-		}
-		strcat(bp, "\ndisconnects done:   ");
-		for (x = 0; x < 7; x++) {
-			sprintf(tbuf, "\t%ld", hd->disc_done_cnt[x]);
-			strcat(bp, tbuf);
-		}
-		sprintf(tbuf, "\ninterrupts:      \t%ld", hd->int_cnt);
-		strcat(bp, tbuf);
+		seq_printf(m, "\ncommands issued:    ");
+		for (x = 0; x < 7; x++)
+			seq_printf(m, "\t%ld", hd->cmd_cnt[x]);
+		seq_printf(m, "\ndisconnects allowed:");
+		for (x = 0; x < 7; x++)
+			seq_printf(m, "\t%ld", hd->disc_allowed_cnt[x]);
+		seq_printf(m, "\ndisconnects done:   ");
+		for (x = 0; x < 7; x++)
+			seq_printf(m, "\t%ld", hd->disc_done_cnt[x]);
+		seq_printf(m, "\ninterrupts:      \t%ld", hd->int_cnt);
 	}
 #endif
 	if (hd->proc & PR_CONNECTED) {
-		strcat(bp, "\nconnected:     ");
+		seq_printf(m, "\nconnected:     ");
 		if (hd->connected) {
 			cmd = (Scsi_Cmnd *) hd->connected;
-			sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
-			strcat(bp, tbuf);
+			seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
 		}
 	}
 	if (hd->proc & PR_INPUTQ) {
-		strcat(bp, "\ninput_Q:       ");
+		seq_printf(m, "\ninput_Q:       ");
 		cmd = (Scsi_Cmnd *) hd->input_Q;
 		while (cmd) {
-			sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
-			strcat(bp, tbuf);
+			seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
 			cmd = (Scsi_Cmnd *) cmd->host_scribble;
 		}
 	}
 	if (hd->proc & PR_DISCQ) {
-		strcat(bp, "\ndisconnected_Q:");
+		seq_printf(m, "\ndisconnected_Q:");
 		cmd = (Scsi_Cmnd *) hd->disconnected_Q;
 		while (cmd) {
-			sprintf(tbuf, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
-			strcat(bp, tbuf);
+			seq_printf(m, " %d:%d(%02x)", cmd->device->id, cmd->device->lun, cmd->cmnd[0]);
 			cmd = (Scsi_Cmnd *) cmd->host_scribble;
 		}
 	}
 	if (hd->proc & PR_TEST) {
 		;		/* insert your own custom function here */
 	}
-	strcat(bp, "\n");
+	seq_printf(m, "\n");
 	spin_unlock_irqrestore(instance->host_lock, flags);
-	*start = buf;
-	if (stop) {
-		stop = 0;
-		return 0;	/* return 0 to signal end-of-file */
-	}
-	if (off > 0x40000)	/* ALWAYS stop after 256k bytes have been read */
-		stop = 1;
-	if (hd->proc & PR_STOP)	/* stop every other time */
-		stop = 1;
-	return strlen(bp);
-
-#else				/* PROC_INTERFACE */
-
+#endif				/* PROC_INTERFACE */
 	return 0;
-
-#endif				/* PROC_INTERFACE */
-
 }

 MODULE_LICENSE("GPL");
@@ -2319,7 +2284,8 @@

 static struct scsi_host_template driver_template = {
 	.proc_name       		= "in2000",
-	.proc_info       		= in2000_proc_info,
+	.write_info       		= in2000_write_info,
+	.show_info       		= in2000_show_info,
 	.name            		= "Always IN2000",
 	.detect          		= in2000_detect,
 	.release			= in2000_release,


arkfb: use display information in info not in var for panning

We must not use any information in the passed var besides xoffset,
yoffset and vmode as otherwise applications might abuse it.

Signed-off-by: Laurent Pinchart <3ded2f39a78f0d7044839546f95841842b4d7c96@ideasonboard.com>
Cc: Ondrej Zajicek <792d28329de7ed446c01b83f731a071248ffeaf4@crfreenet.org>
Signed-off-by: Paul Mundt <38b52dbb5f0b63d149982b6c5de788ec93a89032@linux-sh.org>

--- drivers/video/arkfb.c
+++ drivers/video/arkfb.c
@@ -908,13 +908,14 @@
 	unsigned int offset;

 	/* Calculate the offset */
-	if (var->bits_per_pixel == 0) {
-		offset = (var->yoffset / 16) * (var->xres_virtual / 2) + (var->xoffset / 2);
+	if (info->var.bits_per_pixel == 0) {
+		offset = (var->yoffset / 16) * (info->var.xres_virtual / 2)
+		       + (var->xoffset / 2);
 		offset = offset >> 2;
 	} else {
 		offset = (var->yoffset * info->fix.line_length) +
-			 (var->xoffset * var->bits_per_pixel / 8);
-		offset = offset >> ((var->bits_per_pixel == 4) ? 2 : 3);
+			 (var->xoffset * info->var.bits_per_pixel / 8);
+		offset = offset >> ((info->var.bits_per_pixel == 4) ? 2 : 3);
 	}

 	/* Set the offset */


video: mx3fb: remove unneeded mach/hardware.h inclusion

The inclusion of mach/hardware.h is not used by the driver at all.
Remove it.

Signed-off-by: Shawn Guo <912cf7eb7d8018e2943586ae6657d21fd4e38239@linaro.org>
Acked-by: Sascha Hauer <c00cbc2b736c26791a3822db86f8796fe9efff67@pengutronix.de>
Acked-by: Arnd Bergmann <f2c659f01951776204a6c5b902787d9019fbeebd@arndb.de>
Cc: Florian Tobias Schandinat <9843642cd7809d7c6d8c25ac9e4b0e2f1b5283bf@gmx.de>
Cc: 884c56c11fd64773fc86cd52a4ea5cbef674401a@vger.kernel.org

--- drivers/video/mx3fb.c
+++ drivers/video/mx3fb.c
@@ -29,7 +29,6 @@
 #include <linux/dma/ipu-dma.h>

 #include <linux/platform_data/dma-imx.h>
-#include <mach/hardware.h>
 #include <linux/platform_data/video-mx3fb.h>

 #include <asm/io.h>


neofb: Fix pseudo_palette array overrun in neofb_setcolreg

The pseudo_palette has room for 16 entries only, but in truecolor mode, it
attempts to write 256.

Signed-off-by: Antonino Daplas <be03a811842969f6b435f66cb85a30eb479a8702@gmail.com>
Acked-by: Tero Roponen <3e40baab442f4c470f2845d22fd21ce16dc7c00c@jyu.fi>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/video/neofb.c
+++ drivers/video/neofb.c
@@ -1286,34 +1286,36 @@
 	if (regno >= fb->cmap.len || regno > 255)
 		return -EINVAL;

-	switch (fb->var.bits_per_pixel) {
-	case 8:
+	if (fb->var.bits_per_pixel <= 8) {
 		outb(regno, 0x3c8);

 		outb(red >> 10, 0x3c9);
 		outb(green >> 10, 0x3c9);
 		outb(blue >> 10, 0x3c9);
-		break;
-	case 16:
-		((u32 *) fb->pseudo_palette)[regno] =
+	} else if (regno < 16) {
+		switch (fb->var.bits_per_pixel) {
+		case 16:
+			((u32 *) fb->pseudo_palette)[regno] =
 				((red & 0xf800)) | ((green & 0xfc00) >> 5) |
 				((blue & 0xf800) >> 11);
-		break;
-	case 24:
-		((u32 *) fb->pseudo_palette)[regno] =
+			break;
+		case 24:
+			((u32 *) fb->pseudo_palette)[regno] =
 				((red & 0xff00) << 8) | ((green & 0xff00)) |
 				((blue & 0xff00) >> 8);
-		break;
+			break;
 #ifdef NO_32BIT_SUPPORT_YET
-	case 32:
-		((u32 *) fb->pseudo_palette)[regno] =
+		case 32:
+			((u32 *) fb->pseudo_palette)[regno] =
 				((transp & 0xff00) << 16) | ((red & 0xff00) << 8) |
 				((green & 0xff00)) | ((blue & 0xff00) >> 8);
-		break;
+			break;
 #endif
-	default:
-		return 1;
-	}
+		default:
+			return 1;
+		}
+	}
+
 	return 0;
 }


pm3fb: possible cleanups

pm3fb: possible cleanups

- remove the empty pm3fb_setup() and corresponding code

- pm3fb_init() can become static

[adaplas]
- retain call to fb_get_options() for global options

Signed-off-by: Adrian Bunk <0b86548ef377da0031a3ff3f0c4e06f016e20105@stusta.de>
Signed-off-by: Antonino Daplas <be03a811842969f6b435f66cb85a30eb479a8702@gmail.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- drivers/video/pm3fb.c
+++ drivers/video/pm3fb.c
@@ -612,8 +612,6 @@
 /*
  * hardware independent functions
  */
-int pm3fb_init(void);
-
 static int pm3fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 {
 	u32 lpitch;
@@ -1170,35 +1168,12 @@

 MODULE_DEVICE_TABLE(pci, pm3fb_id_table);

+static int __init pm3fb_init(void)
+{
 #ifndef MODULE
-	/*
-	 *  Setup
-	 */
-
-/*
- * Only necessary if your driver takes special options,
- * otherwise we fall back on the generic fb_setup().
- */
-static int __init pm3fb_setup(char *options)
-{
-	/* Parse user speficied options (`video=pm3fb:') */
-	return 0;
-}
-#endif /* MODULE */
-
-int __init pm3fb_init(void)
-{
-	/*
-	 *  For kernel boot options (in 'video=pm3fb:<options>' format)
-	 */
-#ifndef MODULE
-	char *option = NULL;
-
-	if (fb_get_options("pm3fb", &option))
+	if (fb_get_options("pm3fb", NULL))
 		return -ENODEV;
-	pm3fb_setup(option);
 #endif
-
 	return pci_register_driver(&pm3fb_driver);
 }


bridge: Give a default size to a new pty

Otherwise applications will get 0x0, and not all handle that well.
The fish shell, for example, will refuse to print its prompt and
commandline.

Fixes #4523
Closes #4537
Reviewed-by: Lars Uebernickel <3318dc5ce3e4fb7c28a0b841b6801c884e1d0896@uebernic.de>

--- src/common/cockpitpipe.c
+++ src/common/cockpitpipe.c
@@ -1195,11 +1195,12 @@
   const gchar *path = NULL;
   GPid pid = 0;
   int fd;
+  struct winsize winsz = { 24, 80, 0, 0 };

   if (env)
     path = g_environ_getenv ((gchar **)env, "PATH");

-  pid = forkpty (&fd, NULL, NULL, NULL);
+  pid = forkpty (&fd, NULL, NULL, &winsz);
   if (pid == 0)
     {
       if (cockpit_unix_fd_close_all (3, -1) < 0)


ps3fb: Remove useless debug checks in ps3fb_shutdown()

Signed-off-by: Geert Uytterhoeven <205f5bcb2ea42515c4425a82ddba45c7ca0f2905@sonycom.com>
Cc: 72118316cdc3e52d0d8d71a6d786b65e3dc1d53c@lists.sourceforge.net
Signed-off-by: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>

--- drivers/video/ps3fb.c
+++ drivers/video/ps3fb.c
@@ -1247,7 +1247,6 @@

 static int ps3fb_shutdown(struct ps3_system_bus_device *dev)
 {
-	int status;
 	struct fb_info *info = dev->core.driver_data;

 	dev_dbg(&dev->core, " -> %s:%d\n", __func__, __LINE__);
@@ -1271,17 +1270,8 @@
 		info = dev->core.driver_data = NULL;
 	}
 	iounmap((u8 __force __iomem *)ps3fb.dinfo);
-
-	status = lv1_gpu_context_free(ps3fb.context_handle);
-	if (status)
-		dev_dbg(&dev->core, "lv1_gpu_context_free failed: %d\n",
-			status);
-
-	status = lv1_gpu_memory_free(ps3fb.memory_handle);
-	if (status)
-		dev_dbg(&dev->core, "lv1_gpu_memory_free failed: %d\n",
-			status);
-
+	lv1_gpu_context_free(ps3fb.context_handle);
+	lv1_gpu_memory_free(ps3fb.memory_handle);
 	ps3_close_hv_device(dev);
 	dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__);


Use PYTHONHOME to find lib if it is set

Use PYTHONHOME to find lib if it is set

--- com.ibm.streamsx.topology/opt/python/include/splpy.h
+++ com.ibm.streamsx.topology/opt/python/include/splpy.h
@@ -151,7 +151,21 @@
       	// symbols from libpython*.*.so are not resolved properly. As
       	// as workaround, it's necessary to manually rediscover the
       	// symbols by calling dlopen().
-	if(NULL == dlopen("libpython3.5m.so", RTLD_LAZY |
+      	//
+      	// Also loading it this way makes the Streams bundle (sab)
+      	// file relocatable.
+
+        std::string pyLib("libpython3.5m.so");
+        char * pyHome = getenv("PYTHONHOME");
+        if (pyHome != NULL) {
+            std::string wk(pyHome);
+            wk.append("/lib/");
+            wk.append(pyLib);
+
+            pyLib = wk;
+        }
+
+	if(NULL == dlopen(pyLib.c_str(), RTLD_LAZY |
 			  RTLD_GLOBAL)){
 	  SPLAPPLOG(L_ERROR, "Fatal error: could not open libpython3.5m.so", "python");
 	  throw;


drivers/w5100/w5100.c: correct pointer position

--- drivers/w5100/w5100.c
+++ drivers/w5100/w5100.c
@@ -73,6 +73,7 @@
 static uint16_t raddr(w5100_t *dev, uint16_t addr_high, uint16_t addr_low)
 {
     uint16_t res = (rreg(dev, addr_high) << 8);
+
     res |= rreg(dev, addr_low);
     return res;
 }
@@ -143,7 +144,7 @@

     /* reset the device */
     wreg(dev, REG_MODE, MODE_RESET);
-    while (rreg(dev, REG_MODE) & MODE_RESET) {};
+    while (rreg(dev, REG_MODE) & MODE_RESET) {}

     /* initialize the device, start with writing the MAC address */
     luid_get(hwaddr, ETHERNET_ADDR_LEN);
@@ -183,7 +184,7 @@
         size_t limit = ((S0_TX_BASE + S0_MEMSIZE) - start);
         wchunk(dev, start, data, limit);
         wchunk(dev, S0_TX_BASE, &((uint8_t *)data)[limit], len - limit);
-        return (S0_TX_BASE + limit);
+        return (S0_TX_BASE + len - limit);
     }
     else {
         wchunk(dev, start, data, len);
@@ -218,7 +219,7 @@

     /* trigger the sending process */
     wreg(dev, S0_CR, CR_SEND_MAC);
-    while (!(rreg(dev, S0_IR) & IR_SEND_OK)) {};
+    while (!(rreg(dev, S0_IR) & IR_SEND_OK)) {}
     wreg(dev, S0_IR, IR_SEND_OK);

     DEBUG("[w5100] send: transferred %i byte (at 0x%04x)\n", sum, (int)pos);
@@ -257,10 +258,11 @@
         /* find the size of the next packet in the RX buffer */
         uint16_t rp = raddr(dev, S0_RX_RD0, S0_RX_RD1);
         uint16_t psize = raddr(dev, (S0_RX_BASE + (rp & S0_MASK)),
-                                  (S0_RX_BASE + ((rp + 1) & S0_MASK)));
+                               (S0_RX_BASE + ((rp + 1) & S0_MASK)));
         len = psize - 2;

-        DEBUG("[w5100] recv: got packet of %i byte (at 0x%04x)\n", len, (int)rp);
+        DEBUG("[w5100] recv: got packet of %i byte (at 0x%04x)\n", len,
+              (int)rp);

         /* read the actual data into the given buffer if wanted */
         if (in_buf != NULL) {
@@ -321,16 +323,16 @@
     int res = 0;

     switch (opt) {
-        case NETOPT_ADDRESS:
-            assert(max_len >= ETHERNET_ADDR_LEN);
-            spi_acquire(dev->p.spi, dev->p.cs, SPI_CONF, dev->p.clk);
-            rchunk(dev, REG_SHAR0, value, ETHERNET_ADDR_LEN);
-            spi_release(dev->p.spi);
-            res = ETHERNET_ADDR_LEN;
-            break;
-        default:
-            res = netdev_eth_get(netdev, opt, value, max_len);
-            break;
+    case NETOPT_ADDRESS:
+        assert(max_len >= ETHERNET_ADDR_LEN);
+        spi_acquire(dev->p.spi, dev->p.cs, SPI_CONF, dev->p.clk);
+        rchunk(dev, REG_SHAR0, value, ETHERNET_ADDR_LEN);
+        spi_release(dev->p.spi);
+        res = ETHERNET_ADDR_LEN;
+        break;
+    default:
+        res = netdev_eth_get(netdev, opt, value, max_len);
+        break;
     }

     return res;


Revert previous checkin, the check is for <, not ==.  i is unsed in non-debug builds, but is used in debug builds

--- Parser/pgen.c
+++ Parser/pgen.c
@@ -276,11 +276,14 @@
 static void
 compile_atom(labellist *ll, nfa *nf, node *n, int *pa, int *pb)
 {
+	int i;
+
 	REQ(n, ATOM);
-	REQN(n->n_nchildren, 1);
+	i = n->n_nchildren;
+	REQN(i, 1);
 	n = n->n_child;
 	if (n->n_type == LPAR) {
-		REQN(n->n_nchildren, 3);
+		REQN(i, 3);
 		n++;
 		REQ(n, RHS);
 		compile_rhs(ll, nf, n, pa, pb);


massign: interpret channel number <= 0 as all channels

--- OOps/midiops.c
+++ OOps/midiops.c
@@ -55,15 +55,25 @@

 int massign(CSOUND *csound, MASSIGN *p)
 {
-    int   chnl = (int) (*p->chnl - FL(0.5));
+    int   chnl = (int) (*p->chnl + FL(0.5));
     long  instno = 0L;
+    int   resetCtls;
+    int   retval = OK;

     if (p->XSTRCODE || *(p->insno) >= FL(0.5)) {
       if ((instno = strarg2insno(csound, p->insno, p->XSTRCODE)) <= 0L)
         return NOTOK;
     }
-    return m_chinsno(csound,
-                     chnl, (int) instno, (*p->iresetctls == FL(0.0) ? 0 : 1));
+    resetCtls = (*p->iresetctls == FL(0.0) ? 0 : 1);
+    if (--chnl >= 0)
+      retval = m_chinsno(csound, chnl, (int) instno, resetCtls);
+    else {
+      for (chnl = 0; chnl < 16; chnl++) {
+        if (m_chinsno(csound, chnl, (int) instno, resetCtls) != OK)
+          retval = NOTOK;
+      }
+    }
+    return retval;
 }

 int ctrlinit(CSOUND *csound, CTLINIT *p)


fix boost::optional

fix boost::optional

--- include/ir/index_manager/index/rtype/TermEnum.h
+++ include/ir/index_manager/index/rtype/TermEnum.h
@@ -4,6 +4,7 @@
 #include <ir/index_manager/index/rtype/Compare.h>
 #include <types.h>
 #include <boost/function.hpp>
+#include <boost/optional.hpp>
 #include <3rdparty/am/stx/btree_map.h>
 #include "InMemoryBTreeCache.h"
 #include <util/ClockTimer.h>


quiet compiler warnings on Visual Studio 2008

--- demo/liveview-glut.c
+++ demo/liveview-glut.c
@@ -102,10 +102,10 @@
   size_t i,j;
   const unsigned char *src_chunk;
   unsigned char *dest_chunk;
-  for (i=0; i<height; i++) {
+  for (i=0; i<(unsigned int)height; i++) {
     src_chunk = src_pixels + i*src_stride;
     dest_chunk = dest_pixels + i*dest_stride;
-    for (j=0; j<(width/2); j++) {
+    for (j=0; j<((unsigned int)width/2); j++) {
       dest_chunk[0] = src_chunk[1];
       dest_chunk[1] = src_chunk[3];
       dest_chunk+=2;
@@ -368,8 +368,8 @@

   if (use_pbo) {
     // align
-    PBO_stride = (width/32)*32;
-    if (PBO_stride<width) PBO_stride+=32;
+    PBO_stride = ((unsigned int)width/32)*32;
+    if (PBO_stride<(unsigned int)width) PBO_stride+=32;
     tex_width = PBO_stride;
     tex_height = height;

@@ -438,7 +438,7 @@

 void grab_frame(void); /* forward declaration */

-void display_pixels() {
+void display_pixels(void) {
   GLuint textureId;
   int i;
   int ncols,nrows,col_idx,row_idx;


old cygwin patch to allow ignoring cert perms

--- gsi/sysconfig/source/library/globus_gsi_system_config.c
+++ gsi/sysconfig/source/library/globus_gsi_system_config.c
@@ -192,6 +192,11 @@

 int globus_i_gsi_sysconfig_debug_level = 0;

+
+#ifdef TARGET_ARCH_CYGWIN
+static int globus_l_gsi_sysconfig_skip_check = 0;
+#endif
+
 /**
  * Module descriptor static initializer.
  */
@@ -252,6 +257,15 @@
     }

     GLOBUS_I_GSI_SYSCONFIG_DEBUG_ENTER;
+
+#ifdef TARGET_ARCH_CYGWIN
+    /* windows permissions are a pain, and cygwin won't give reliable
+    permissions when a non-posix path is used anyways */
+    if(getenv("GLOBUS_IGNORE_CRED_PERMS"))
+    {
+        globus_l_gsi_sysconfig_skip_check = 1;
+    }
+#endif

     result = globus_module_activate(GLOBUS_COMMON_MODULE);

@@ -4577,6 +4591,13 @@

     GLOBUS_I_GSI_SYSCONFIG_DEBUG_ENTER;

+#ifdef TARGET_ARCH_CYGWIN
+    if(globus_l_gsi_sysconfig_skip_check)
+    {
+        return globus_gsi_sysconfig_file_exists_unix(filename);
+    }
+#endif
+
     if (stat(filename,&stx) == -1)
     {
         switch (errno)
@@ -4703,6 +4724,13 @@
         "globus_i_gsi_sysconfig_check_certfile_unix";

     GLOBUS_I_GSI_SYSCONFIG_DEBUG_ENTER;
+
+#ifdef TARGET_ARCH_CYGWIN
+    if(globus_l_gsi_sysconfig_skip_check)
+    {
+        return globus_gsi_sysconfig_file_exists_unix(filename);
+    }
+#endif

     if (stat(filename,&stx) == -1)
     {


Upgraded to VS2022

Upgraded to VS2022

--- gpftw/ftw_array_view.h
+++ gpftw/ftw_array_view.h
@@ -23,7 +23,7 @@
 		template <size_t _elementCount>
 		inline constexpr							array_view					(_tElement (&_dataElements)[_elementCount])									noexcept	: Data(_dataElements), Count(_elementCount)										{}
 		template <size_t _elementCount>
-		inline constexpr							array_view					(_tElement (&_dataElements)[_elementCount], uint32_t elementCount)			noexcept	: Data(_dataElements), Count(::ftwl::min(_elementCount, elementCount))			{}
+		inline constexpr							array_view					(_tElement (&_dataElements)[_elementCount], uint32_t elementCount)			noexcept	: Data(_dataElements), Count(::ftwl::min((uint32_t)_elementCount, elementCount))			{}

 		// Operators
 							_tElement&				operator[]					(uint32_t index)																		{ if(0 == Data) throw(::std::exception("Uninitialized array pointer.")); if(index >= Count) throw(::std::exception("Invalid index.")); return Data[index]; }


Document _transition_type 3.

Document _transition_type 3.

--- src/framework/mlt_transition.h
+++ src/framework/mlt_transition.h
@@ -35,7 +35,7 @@
  * \properties \em b_track the track index (0-based) of a multitrack of the second producer
  * \properties \em accepts_blanks a flag to indicate if the transition should accept blank frames
  * \properties \em always_active a flag to indicate that the in and out points do not apply
- * \properties \em _transition_type 1 for video, 2 for audio
+ * \properties \em _transition_type 1 for video, 2 for audio, 3 for both audio and video
  * \properties \em disable Set this to disable the transition while keeping it in the object model.
  */


Fix for size_t in UpnpString. (cherry picked from commit ee5bd670d4eeb09bf2ebc0e01a902ebac93aa5b8)

--- upnp/src/api/UpnpString.c
+++ upnp/src/api/UpnpString.c
@@ -49,7 +49,7 @@
 struct SUpnpString
 {
 	/*! \brief Length of the string. */
-	int m_length;
+	size_t m_length;
 	/*! \brief Pointer to a dynamically allocated area that holds the NULL
 	 * terminated string. */
 	char *m_string;


Fixing documentation errors

Fixing documentation errors

Minor errors in the documentation were fixed. These caused failure
of the doxygen checks in the PR.

--- connectivity/netsocket/include/netsocket/MsgHeader.h
+++ connectivity/netsocket/include/netsocket/MsgHeader.h
@@ -38,9 +38,10 @@
     } nsapi_pktinfo_t;
  * @endcode
  *
- * There are two requirements for such structs to work well with MsgHeaderIterator:
- * first element needs to of type nsapi_msghdr_t
- * value of the field len of the nsapi_msghdr_t needs to bet set to the size of the whole extending type. For example:
+ * There are two requirements for such structures to work well with MsgHeaderIterator.
+ * - First element needs to be of type nsapi_msghdr_t.
+ * - Value of the field len of the nsapi_msghdr_t needs to bet set to the size of the whole extending type.
+ *   For example:
  *
  * @code
     nsapi_pktinfo_t pkt_info;
@@ -54,7 +55,6 @@
  * Code presenting minimal usage example.
  *
  * @code
- *
     struct default_buffer_t {
         default_buffer_t()
         {
@@ -84,8 +84,8 @@
      auto p5 = it.next() // returns nullptr
  * @endcode
  *
- * @note More usage examples are implemented in the `MsgHeaderIterator` unit test
- *  in `netsocket/tests/UNITTESTS/NetworkStack/test_MsgHeaderIterator.cpp`
+ * @note More usage examples are implemented in the MsgHeaderIterator unit test
+ *  in netsocket/tests/UNITTESTS/NetworkStack/test_MsgHeaderIterator.cpp
  */

 struct MsgHeaderIterator {