[PATCH 1/1] Staging: iio: Coding style correction

2015-02-07 Thread Tolga Ceylan
Line over 80 characters corrected

Signed-off-by: Tolga Ceylan 
---
 drivers/staging/iio/meter/ade7854-i2c.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/meter/ade7854-i2c.c 
b/drivers/staging/iio/meter/ade7854-i2c.c
index 5b33c7f..5d0671a 100644
--- a/drivers/staging/iio/meter/ade7854-i2c.c
+++ b/drivers/staging/iio/meter/ade7854-i2c.c
@@ -195,7 +195,8 @@ static int ade7854_i2c_read_reg_32(struct device *dev,
if (ret)
goto out;
 
-   *val = (st->rx[0] << 24) | (st->rx[1] << 16) | (st->rx[2] << 8) | 
st->rx[3];
+   *val = (st->rx[0] << 24) | (st->rx[1] << 16) |
+   (st->rx[2] << 8) | st->rx[3];
 out:
mutex_unlock(>buf_lock);
return ret;
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pci: spear: Drop __initdata from struct platform_driver spear13xx_pcie_driver

2015-02-07 Thread Matwey V. Kornilov
spear13xx_pcie_driver.driver is allocated in text.init section
and then the pointer to it is passed futher. This patch is to avoid
crashes like the following, when freed memory is used:

 #0  __device_attach (drv=0xc0ed5608 , 
data=0xdb622610) at ../drivers/base/dd.c:409
 #1  0xc07a4798 in bus_for_each_drv (bus=, start=, data=0xda0, fn=0xc07a6740 <__device_attach>)
at ../drivers/base/bus.c:463
 #2  0xc07a6324 in device_attach (dev=0xdb622610) at ../drivers/base/dd.c:447
 #3  0xc07a5814 in bus_probe_device (dev=0xdb622610) at 
../drivers/base/bus.c:558
 #4  0xc07a38d8 in device_add (dev=) at 
../drivers/base/core.c:1058
 #5  0xc08b6a5c in of_device_add (ofdev=) at 
../drivers/of/device.c:66
 #6  0xc08b742c in of_platform_device_create_pdata (np=, 
bus_id=0x0 <__vectors_start>, platform_data=0x0 <__vectors_start>,
parent=) at ../drivers/of/platform.c:241
 #7  0xc08b7568 in of_platform_bus_create (bus=0xdfa46780, matches=0x0 
<__vectors_start>, lookup=0x0 <__vectors_start>, parent=0xdb183410,
strict=true) at ../drivers/of/platform.c:414
 #8  0xc08b79bc in of_platform_populate (root=0xc0ed5608 
, matches=0xdb622610, lookup=0xda0,
parent=0xc07a6740 <__device_attach>) at ../drivers/of/platform.c:501
 #9  0xbf30 in am335x_child_probe (pdev=0xdb183400) at 
../drivers/usb/musb/musb_am335x.c:12
 #10 0xc07a83f0 in platform_drv_probe (_dev=0xdb183410) at 
../drivers/base/platform.c:512
 #11 0xc07a64e8 in really_probe (drv=, dev=) at 
../drivers/base/dd.c:302
 #12 driver_probe_device (drv=0xbf000234, dev=0xdb183410) at 
../drivers/base/dd.c:399
 #13 0xc07a6820 in __driver_attach (dev=0xdb183410, data=0xbf000234) at 
../drivers/base/dd.c:477
 #14 0xc07a46e8 in bus_for_each_dev (bus=, start=, data=0xda0, fn=0xc07a83a4 )
at ../drivers/base/bus.c:313
 #15 0xc07a5ebc in driver_attach (drv=) at 
../drivers/base/dd.c:496
 #16 0xc07a5af0 in bus_add_driver (drv=0xbf000234) at ../drivers/base/bus.c:694
 #17 0xc07a6fec in driver_register (drv=0xbf000234) at 
../drivers/base/driver.c:167
 #18 0xc0209c34 in do_one_initcall (fn=0xbf002000) at ../init/main.c:801
 #19 0xc02e0494 in do_init_module (mod=) at 
../kernel/module.c:3142
 #20 load_module (info=0xdb6b1f54, uargs=, flags=) at ../kernel/module.c:3461
 #21 0xc02e0a44 in SYSC_finit_module (flags=, uargs=, fd=) at ../kernel/module.c:3537
 #22 SyS_finit_module (fd=7, uargs=-1225602132, flags=0) at 
../kernel/module.c:3518
 #23 0xc021a680 in ?? ()

Fixes: 6675ef212da (PCI: spear: Fix Section mismatch compilation warning for 
probe())
Signed-off-by: Matwey V. Kornilov 
---
 drivers/pci/host/pcie-spear13xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/host/pcie-spear13xx.c 
b/drivers/pci/host/pcie-spear13xx.c
index 866465f..435651d 100644
--- a/drivers/pci/host/pcie-spear13xx.c
+++ b/drivers/pci/host/pcie-spear13xx.c
@@ -370,7 +370,7 @@ static const struct of_device_id spear13xx_pcie_of_match[] 
= {
 };
 MODULE_DEVICE_TABLE(of, spear13xx_pcie_of_match);
 
-static struct platform_driver spear13xx_pcie_driver __initdata = {
+static struct platform_driver spear13xx_pcie_driver = {
.probe  = spear13xx_pcie_probe,
.driver = {
.name   = "spear-pcie",
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: wlan-ng: Use setup_timer

2015-02-07 Thread Vaishali Thakkar
This patch introduces the use of function setup_timer.

This is done using Coccinelle and semantic patch used is
as follows:

@@
expression x,y,z;
@@

- init_timer ();
+ setup_timer (, y, z);
- x.function = y;
- x.data = z;

Signed-off-by: Vaishali Thakkar 
---
 drivers/staging/wlan-ng/hfa384x_usb.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c 
b/drivers/staging/wlan-ng/hfa384x_usb.c
index 2245339..77066a1 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -557,17 +557,13 @@ void hfa384x_create(hfa384x_t *hw, struct usb_device *usb)
INIT_WORK(>link_bh, prism2sta_processing_defer);
INIT_WORK(>usb_work, hfa384x_usb_defer);
 
-   init_timer(>throttle);
-   hw->throttle.function = hfa384x_usb_throttlefn;
-   hw->throttle.data = (unsigned long)hw;
+   setup_timer(>throttle, hfa384x_usb_throttlefn, (unsigned long)hw);
 
-   init_timer(>resptimer);
-   hw->resptimer.function = hfa384x_usbctlx_resptimerfn;
-   hw->resptimer.data = (unsigned long)hw;
+   setup_timer(>resptimer, hfa384x_usbctlx_resptimerfn,
+   (unsigned long)hw);
 
-   init_timer(>reqtimer);
-   hw->reqtimer.function = hfa384x_usbctlx_reqtimerfn;
-   hw->reqtimer.data = (unsigned long)hw;
+   setup_timer(>reqtimer, hfa384x_usbctlx_reqtimerfn,
+   (unsigned long)hw);
 
usb_init_urb(>rx_urb);
usb_init_urb(>tx_urb);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: dgnc: Use setup_timer

2015-02-07 Thread Vaishali Thakkar
This patch introduces the use of function setup_timer.

This is done using Coccinelle and semantic patch used is
as follows:

@@
expression x,y,z;
@@

- init_timer ();
+ setup_timer (, y, z);
- x.function = y;
- x.data = z;

Signed-off-by: Vaishali Thakkar 
---
 drivers/staging/dgnc/dgnc_driver.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index f610ae1..95f47f7 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -285,9 +285,7 @@ static int dgnc_start(void)
 
/* Start the poller */
spin_lock_irqsave(_poll_lock, flags);
-   init_timer(_poll_timer);
-   dgnc_poll_timer.function = dgnc_poll_handler;
-   dgnc_poll_timer.data = 0;
+   setup_timer(_poll_timer, dgnc_poll_handler, 0);
dgnc_poll_time = jiffies + dgnc_jiffies_from_ms(dgnc_poll_tick);
dgnc_poll_timer.expires = dgnc_poll_time;
spin_unlock_irqrestore(_poll_lock, flags);
@@ -731,9 +729,7 @@ static void dgnc_poll_handler(ulong dummy)
if ((ulong) new_time >= 2 * dgnc_poll_tick)
dgnc_poll_time = jiffies +  
dgnc_jiffies_from_ms(dgnc_poll_tick);
 
-   init_timer(_poll_timer);
-   dgnc_poll_timer.function = dgnc_poll_handler;
-   dgnc_poll_timer.data = 0;
+   setup_timer(_poll_timer, dgnc_poll_handler, 0);
dgnc_poll_timer.expires = dgnc_poll_time;
spin_unlock_irqrestore(_poll_lock, flags);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mtd: avoid registering reboot notifier twice

2015-02-07 Thread Brian Norris
On Sun, Feb 01, 2015 at 02:08:50AM +0100, Niklas Cassel wrote:
> Calling mtd_device_parse_register with the same mtd_info
> (e.g. registering several partitions on a single device)
> would add the same reboot notifier twice, causing an
> infinte loop in notifier_chain_register during boot up.
> 
> Signed-off-by: Niklas Cassel 

Begrudgingly applied to l2-mtd.git. It's better to fix this bug than for
me just to complain about badly written board files and drivers...

> ---
>  drivers/mtd/mtdcore.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
> index de79576..98efc1e 100644
> --- a/drivers/mtd/mtdcore.c
> +++ b/drivers/mtd/mtdcore.c
> @@ -556,7 +556,7 @@ int mtd_device_parse_register(struct mtd_info *mtd, const 
> char * const *types,
>   err = -ENODEV;
>   }
>  

Also added a FIXME comment here to note that some drivers are doing odd
things to require this workaround.

> - if (mtd->_reboot) {
> + if (mtd->_reboot && !mtd->reboot_notifier.notifier_call) {
>   mtd->reboot_notifier.notifier_call = mtd_reboot_notifier;
>   register_reboot_notifier(>reboot_notifier);
>   }

Brian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: comedi: Use setup_timer

2015-02-07 Thread Vaishali Thakkar
This patch introduces the use of function setup_timer.

This is done using Coccinelle and semantic patch used is
as follows:

@@
expression x,y,z;
@@

- init_timer ();
+ setup_timer (, y, z);
- x.function = y;
- x.data = z;

Signed-off-by: Vaishali Thakkar 
---
 drivers/staging/comedi/drivers/comedi_test.c | 5 ++---
 drivers/staging/comedi/drivers/das16.c   | 5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/comedi_test.c 
b/drivers/staging/comedi/drivers/comedi_test.c
index e56525a..fbc4342 100644
--- a/drivers/staging/comedi/drivers/comedi_test.c
+++ b/drivers/staging/comedi/drivers/comedi_test.c
@@ -420,9 +420,8 @@ static int waveform_attach(struct comedi_device *dev,
for (i = 0; i < s->n_chan; i++)
devpriv->ao_loopbacks[i] = s->maxdata / 2;
 
-   init_timer(>timer);
-   devpriv->timer.function = waveform_ai_interrupt;
-   devpriv->timer.data = (unsigned long)dev;
+   setup_timer(>timer, waveform_ai_interrupt,
+   (unsigned long)dev);
 
dev_info(dev->class_dev,
 "%s: %i microvolt, %li microsecond waveform attached\n",
diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index 466d4ef..f971140 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -954,9 +954,8 @@ static void das16_alloc_dma(struct comedi_device *dev, 
unsigned int dma_chan)
devpriv->dma = comedi_isadma_alloc(dev, 2, dma_chan, dma_chan,
   DAS16_DMA_SIZE, COMEDI_ISADMA_READ);
if (devpriv->dma) {
-   init_timer(>timer);
-   devpriv->timer.function = das16_timer_interrupt;
-   devpriv->timer.data = (unsigned long)dev;
+   setup_timer(>timer, das16_timer_interrupt,
+   (unsigned long)dev);
}
 }
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] x86/xen: Cleanup file path in a comment

2015-02-07 Thread Alexander Kuleshov
There is no head.S now, arch/x86/kernel/head_32.S and
arch/x86/kernel/head_64.S instead

Signed-off-by: Alexander Kuleshov 
---
 arch/x86/xen/xen-head.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S
index 674b2225..c73e603 100644
--- a/arch/x86/xen/xen-head.S
+++ b/arch/x86/xen/xen-head.S
@@ -1,5 +1,5 @@
-/* Xen-specific pieces of head.S, intended to be included in the right
-   place in head.S */
+/* Xen-specific pieces of head_{32,64}.S, intended to be included in the right
+   place in head_{32,64}.S */
 
 #ifdef CONFIG_XEN
 
-- 
2.3.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH net-next v2 0/7] r8152: adjust the code

2015-02-07 Thread David Miller
From: Hayes Wang 
Date: Fri, 6 Feb 2015 11:30:44 +0800

> V2:
> Correct the subject of patch #5. Replace "link feed" with "line feed".
> 
> v1:
> Code adjustment.

Series applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCHv2] rds: Make rds_message_copy_from_user() return 0 on success.

2015-02-07 Thread David Miller
From: Sowmini Varadhan 
Date: Thu, 5 Feb 2015 17:41:43 -0500

> Commit 083735f4b01b ("rds: switch rds_message_copy_from_user() to iov_iter")
> breaks rds_message_copy_from_user() semantics on success, and causes it
> to return nbytes copied, when it should return 0.  This commit fixes that bug.
> 
> Signed-off-by: Sowmini Varadhan 
> ---
> changes from v1: incorporate Al.Viro comment. 

Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] net: rds: Remove repeated function names from debug output

2015-02-07 Thread David Miller
From: Rasmus Villemoes 
Date: Thu,  5 Feb 2015 23:17:20 +0100

> The macro rdsdebug is defined as
> 
>   pr_debug("%s(): " fmt, __func__ , ##args)
> 
> Hence it doesn't make sense to include the name of the calling
> function explicitly in the format string passed to rdsdebug.
> 
> Signed-off-by: Rasmus Villemoes 

Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v9 1/3] i2c: iProc: define Broadcom iProc I2C binding

2015-02-07 Thread Ray Jui
Document the I2C device tree binding for Broadcom iProc family of
SoCs

Signed-off-by: Ray Jui 
Reviewed-by: Scott Branden 
Reviewed-by: Kevin Cernekee 
---
 .../devicetree/bindings/i2c/brcm,iproc-i2c.txt |   37 
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt

diff --git a/Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt 
b/Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt
new file mode 100644
index 000..81f982c
--- /dev/null
+++ b/Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt
@@ -0,0 +1,37 @@
+Broadcom iProc I2C controller
+
+Required properties:
+
+- compatible:
+Must be "brcm,iproc-i2c"
+
+- reg:
+Define the base and range of the I/O address space that contain the iProc
+I2C controller registers
+
+- interrupts:
+Should contain the I2C interrupt
+
+- clock-frequency:
+This is the I2C bus clock. Need to be either 10 or 40
+
+- #address-cells:
+Always 1 (for I2C addresses)
+
+- #size-cells:
+Always 0
+
+Example:
+   i2c0: i2c@18008000 {
+   compatible = "brcm,iproc-i2c";
+   reg = <0x18008000 0x100>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   interrupts = ;
+   clock-frequency = <10>;
+
+   codec: wm8750@1a {
+   compatible = "wlf,wm8750";
+   reg = <0x1a>;
+   };
+   };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v9 3/3] ARM: dts: add I2C device nodes for Broadcom Cygnus

2015-02-07 Thread Ray Jui
Add I2C device nodes and its properties in bcm-cygnus.dtsi but keep
them disabled there. Individual I2C devices can be enabled in board
specific dts file when I2C slave devices are enabled in the future

Signed-off-by: Ray Jui 
Reviewed-by: Scott Branden 
Reviewed-by: Kevin Cernekee 
---
 arch/arm/boot/dts/bcm-cygnus.dtsi |   20 
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/bcm-cygnus.dtsi 
b/arch/arm/boot/dts/bcm-cygnus.dtsi
index 5126f9e..ff5fb6a 100644
--- a/arch/arm/boot/dts/bcm-cygnus.dtsi
+++ b/arch/arm/boot/dts/bcm-cygnus.dtsi
@@ -70,6 +70,26 @@
};
};
 
+   i2c0: i2c@18008000 {
+   compatible = "brcm,cygnus-iproc-i2c", "brcm,iproc-i2c";
+   reg = <0x18008000 0x100>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   interrupts = ;
+   clock-frequency = <10>;
+   status = "disabled";
+   };
+
+   i2c1: i2c@1800b000 {
+   compatible = "brcm,cygnus-iproc-i2c", "brcm,iproc-i2c";
+   reg = <0x1800b000 0x100>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   interrupts = ;
+   clock-frequency = <10>;
+   status = "disabled";
+   };
+
uart0: serial@1802 {
compatible = "snps,dw-apb-uart";
reg = <0x1802 0x100>;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v9 2/3] i2c: iproc: Add Broadcom iProc I2C Driver

2015-02-07 Thread Ray Jui
Add initial support to the Broadcom iProc I2C controller found in the
iProc family of SoCs.

The iProc I2C controller has separate internal TX and RX FIFOs, each has
a size of 64 bytes. The iProc I2C controller supports two bus speeds
including standard mode (100kHz) and fast mode (400kHz)

Signed-off-by: Ray Jui 
Reviewed-by: Scott Branden 
Reviewed-by: Kevin Cernekee 
---
 drivers/i2c/busses/Kconfig |   10 +
 drivers/i2c/busses/Makefile|1 +
 drivers/i2c/busses/i2c-bcm-iproc.c |  461 
 3 files changed, 472 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-bcm-iproc.c

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index ab838d9..3d08731 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -372,6 +372,16 @@ config I2C_BCM2835
  This support is also available as a module.  If so, the module
  will be called i2c-bcm2835.
 
+config I2C_BCM_IPROC
+   tristate "Broadcom iProc I2C controller"
+   depends on ARCH_BCM_IPROC || COMPILE_TEST
+   default ARCH_BCM_IPROC
+   help
+ If you say yes to this option, support will be included for the
+ Broadcom iProc I2C controller.
+
+ If you don't know what to do here, say N.
+
 config I2C_BCM_KONA
tristate "BCM Kona I2C adapter"
depends on ARCH_BCM_MOBILE
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 56388f6..d93b509 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_I2C_AT91)+= i2c-at91.o
 obj-$(CONFIG_I2C_AU1550)   += i2c-au1550.o
 obj-$(CONFIG_I2C_AXXIA)+= i2c-axxia.o
 obj-$(CONFIG_I2C_BCM2835)  += i2c-bcm2835.o
+obj-$(CONFIG_I2C_BCM_IPROC)+= i2c-bcm-iproc.o
 obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o
 obj-$(CONFIG_I2C_CADENCE)  += i2c-cadence.o
 obj-$(CONFIG_I2C_CBUS_GPIO)+= i2c-cbus-gpio.o
diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c 
b/drivers/i2c/busses/i2c-bcm-iproc.c
new file mode 100644
index 000..d3c8915
--- /dev/null
+++ b/drivers/i2c/busses/i2c-bcm-iproc.c
@@ -0,0 +1,461 @@
+/*
+ * Copyright (C) 2014 Broadcom Corporation
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define CFG_OFFSET   0x00
+#define CFG_RESET_SHIFT  31
+#define CFG_EN_SHIFT 30
+#define CFG_M_RETRY_CNT_SHIFT16
+#define CFG_M_RETRY_CNT_MASK 0x0f
+
+#define TIM_CFG_OFFSET   0x04
+#define TIM_CFG_MODE_400_SHIFT   31
+
+#define M_FIFO_CTRL_OFFSET   0x0c
+#define M_FIFO_RX_FLUSH_SHIFT31
+#define M_FIFO_TX_FLUSH_SHIFT30
+#define M_FIFO_RX_CNT_SHIFT  16
+#define M_FIFO_RX_CNT_MASK   0x7f
+#define M_FIFO_RX_THLD_SHIFT 8
+#define M_FIFO_RX_THLD_MASK  0x3f
+
+#define M_CMD_OFFSET 0x30
+#define M_CMD_START_BUSY_SHIFT   31
+#define M_CMD_STATUS_SHIFT   25
+#define M_CMD_STATUS_MASK0x07
+#define M_CMD_STATUS_SUCCESS 0x0
+#define M_CMD_STATUS_LOST_ARB0x1
+#define M_CMD_STATUS_NACK_ADDR   0x2
+#define M_CMD_STATUS_NACK_DATA   0x3
+#define M_CMD_STATUS_TIMEOUT 0x4
+#define M_CMD_PROTOCOL_SHIFT 9
+#define M_CMD_PROTOCOL_MASK  0xf
+#define M_CMD_PROTOCOL_BLK_WR0x7
+#define M_CMD_PROTOCOL_BLK_RD0x8
+#define M_CMD_PEC_SHIFT  8
+#define M_CMD_RD_CNT_SHIFT   0
+#define M_CMD_RD_CNT_MASK0xff
+
+#define IE_OFFSET0x38
+#define IE_M_RX_FIFO_FULL_SHIFT  31
+#define IE_M_RX_THLD_SHIFT   30
+#define IE_M_START_BUSY_SHIFT28
+
+#define IS_OFFSET0x3c
+#define IS_M_RX_FIFO_FULL_SHIFT  31
+#define IS_M_RX_THLD_SHIFT   30
+#define IS_M_START_BUSY_SHIFT28
+
+#define M_TX_OFFSET  0x40
+#define M_TX_WR_STATUS_SHIFT 31
+#define M_TX_DATA_SHIFT  0
+#define M_TX_DATA_MASK   0xff
+
+#define M_RX_OFFSET  0x44
+#define M_RX_STATUS_SHIFT30
+#define M_RX_STATUS_MASK 0x03
+#define M_RX_PEC_ERR_SHIFT   29
+#define M_RX_DATA_SHIFT  0
+#define M_RX_DATA_MASK   0xff
+
+#define I2C_TIMEOUT_MESC 100
+#define M_TX_RX_FIFO_SIZE64
+
+enum bus_speed_index {
+   I2C_SPD_100K = 0,
+   I2C_SPD_400K,
+};
+
+struct bcm_iproc_i2c_dev {
+

[PATCH v9 0/3] Add I2C support to Broadcom iProc

2015-02-07 Thread Ray Jui
This patchset contains the initial I2C support for Broadcom iProc family of
SoCs.

The iProc I2C controller has separate internal TX and RX FIFOs, each has a
size of 64 bytes. The iProc I2C controller supports two bus speeds including
standard mode (100 kHz) and fast mode (400 kHz)

Synced code base to Linux 3.19-rc7

Changes from v8:
 - Sort header includes in alphabetical order
 - Use correct error code
 - Get rid of redundant functions and combine functions to make driver more
   slim
 - Get rid of redundant debugging prints that are already available from the
   I2C framework
 - Other minor improvements

Changes from v7:
 - Remove redundant 10-bit address check in the driver
 - Fix the driver that accidentally emits 1-byte of data with zero content in
   the case of SMBUS quick command
 - Improve debugging prints in the driver
 - Other minor improvements

Changes from v6:
 - Get rid of unnecessary atomic variable usage in the driver
 - Improve the "waiting for transaction to complete" logic further by making
   sure there's no pending/ongoing interrupt by the time when flag
   'xfer_is_done' is checked
 - After disabling interrupt with 'writel', add 'readl' to the same register
   to flush the bus to ensure the write has gone through

Changes from v5:
 - Improve the "waiting for transaction to be complete" logic to take care of
   the corner case when an interrupt fires after wait_for_completion_timeout
   times out
 - Improve the logic to disable I2C interrupt in the remove function. Make it
   more generic so it works for both dedicated and shared interrupt

Changes from v4:
 - Remove redundant header file includes
 - Change the logic that waits for the host controller to be idle to
   simply return -EBUSY
 - Use proper print level and error codes in the driver
 - Allow zero length message in the driver to support I2C_SMBUS_QUICK
 - Change back to use devm_request_irq. Disable interrupt in the remove
   function so there's no outstanding I2C interrupt when the driver is
   being removed from the framework
 - Other minor miscellaneous improvements and fixes

Changes from v3:
 - Add config dependency to COMPILE_TEST to allow the driver to be build tested
   by other platforms
 - Improve CPU utilization efficiency in the loop of waiting for bus to idle
 - Add more comment in the driver to clarify the way how the "start busy"
   interrupt is triggered from the I2C controller
 - Fix inconsistent coding style and format
 - Improve the bus speed validation logic in the driver
 - Add code to free the interrupt line in driver's remove function. Also
   change to use non-devm API to request the interrupt line
 - Other miscellaneous improvements and fixes

Changes from v2:
 - Have the I2C driver default to y so it does not need to be selected from
   ARCH_BCM_IPROC. This also helps to get rid of one patch. The driver still
   depends on ARCH_BCM_IPROC
 - Get rid of redundant check on resource returned by platform_get_resource

Changes from v1:
 - Fix function argument parenthesis
 - Get rid of redundant driver owner field

Ray Jui (3):
  i2c: iProc: define Broadcom iProc I2C binding
  i2c: iproc: Add Broadcom iProc I2C Driver
  ARM: dts: add I2C device nodes for Broadcom Cygnus

 .../devicetree/bindings/i2c/brcm,iproc-i2c.txt |   37 ++
 arch/arm/boot/dts/bcm-cygnus.dtsi  |   20 +
 drivers/i2c/busses/Kconfig |   10 +
 drivers/i2c/busses/Makefile|1 +
 drivers/i2c/busses/i2c-bcm-iproc.c |  461 
 5 files changed, 529 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/brcm,iproc-i2c.txt
 create mode 100644 drivers/i2c/busses/i2c-bcm-iproc.c

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v8 2/3] i2c: iproc: Add Broadcom iProc I2C Driver

2015-02-07 Thread Ray Jui


On 2/7/2015 9:50 AM, Wolfram Sang wrote:
> Hi Ray,
> 
> On Fri, Feb 06, 2015 at 05:28:26PM -0800, Ray Jui wrote:
>> Add initial support to the Broadcom iProc I2C controller found in the
>> iProc family of SoCs.
>>
>> The iProc I2C controller has separate internal TX and RX FIFOs, each has
>> a size of 64 bytes. The iProc I2C controller supports two bus speeds
>> including standard mode (100kHz) and fast mode (400kHz)
> 
> Mostly looking good.
> 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
> 
> Please sort the includes.
> 

Will do.

>> +static bool bcm_iproc_i2c_bus_busy(struct bcm_iproc_i2c_dev *iproc_i2c)
>> +{
>> +if (readl(iproc_i2c->base + M_CMD_OFFSET) &
>> +(1 << M_CMD_START_BUSY_SHIFT))
>> +return true;
>> +else
>> +return false;
>> +}
> 
> Minor: return !!(readl(...))? You decide.
> 

Okay will do that. Will also remove this function since now it becomes
one line and is used only once.

>> +
>> +static int bcm_iproc_i2c_format_addr(struct bcm_iproc_i2c_dev *iproc_i2c,
>> + struct i2c_msg *msg, u8 *addr)
>> +{
>> +*addr = msg->addr << 1;
>> +
>> +if (msg->flags & I2C_M_RD)
>> +*addr |= 1;
>> +
>> +return 0;
>> +}
> 
> I'd suggest a oneliner.
> 
> *addr = msg->addr << 1 | (msg->flags & I2C_M_RD ? 1 : 0)
> 
> Or use !! like above.
> 
> Don't do an extra function for that. It is only used once and it also
> doesn't need to be int since it can't fail anyhow.
> 
> (Note to self: I should make a macro for that in i2c.h)
> 

Yes will change. Thanks.

>> +/* need to reserve one byte in the FIFO for the slave address */
>> +if (msg->len > M_TX_RX_FIFO_SIZE - 1) {
>> +dev_err(iproc_i2c->device,
>> +"only support data length up to %u bytes\n",
>> +M_TX_RX_FIFO_SIZE - 1);
>> +return -EINVAL;
> 
> -EOPNOTSUPP
> 
> Is it really a HW limitation? Could the driver later be extended to
> continue filling the FIFO if a certain threshold is reached?
> 

Will return -EOPNOTSUPP. This really depends on whether or not we expect
one sequence of START + SLV ADDR + DATA + STOP per i2c message. I can
later extend the driver to refill/re-drain the FIFO for data size >= 64
bytes, if one sequence of SATRT...STOP per message is not a requirement.

>> +dev_dbg(iproc_i2c->device, "xfer %c, addr=0x%02x, len=%d\n",
>> +(msg->flags & I2C_M_RD) ? 'R' : 'W', msg->addr,
>> +msg->len);
>> +dev_dbg(iproc_i2c->device, "*** data: %*ph\n", msg->len, msg->buf);
> 
> Not really needed. We have tracing for that.
> 

Will remove.

>> +if (bus_speed < 10) {
>> +dev_err(iproc_i2c->device, "%d Hz bus speed not supported\n",
>> +bus_speed);
>> +dev_err(iproc_i2c->device,
>> +"valid speeds are 100khz and 400khz\n");
>> +return -EINVAL;
>> +} else if (bus_speed < 40) {
>> +bus_speed = 10;
>> +speed_bit = 0;
>> +} else {
>> +bus_speed = 40;
>> +speed_bit = 1;
>> +}
>> +
>> +val = readl(iproc_i2c->base + TIM_CFG_OFFSET);
>> +val &= ~(1 << TIM_CFG_MODE_400_SHIFT);
>> +val |= speed_bit << TIM_CFG_MODE_400_SHIFT;
> 
> val |= (bus_speed == 40) ...
> 
> and skip speed_bit? You decide.
> 

Okay, I'll get rid of speed_bit.

>> +static void bcm_iproc_i2c_enable(struct bcm_iproc_i2c_dev *iproc_i2c)
>> +{
>> +u32 val;
>> +
>> +val = readl(iproc_i2c->base + CFG_OFFSET);
>> +val |= 1 << CFG_EN_SHIFT;
>> +writel(val, iproc_i2c->base + CFG_OFFSET);
>> +}
>> +
>> +static void bcm_iproc_i2c_disable(struct bcm_iproc_i2c_dev *iproc_i2c)
>> +{
>> +u32 val;
>> +
>> +val = readl(iproc_i2c->base + CFG_OFFSET);
>> +val &= ~(1 << CFG_EN_SHIFT);
>> +writel(val, iproc_i2c->base + CFG_OFFSET);
>> +}
> 
> Extra functions? They are self explaining and only used once. You
> decide.

In fact I'll keep the function, since it will likely be needed later
when we add suspend/resume support to the driver. But I'll combine the
two functions and make it a single function called
bcm_iproc_i2c_enable_disable.

> 
> Rest looks fine, thanks!
> 

Thanks for the review!

Ray
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] llist: Fix missing lockless_dereference()

2015-02-07 Thread Mathieu Desnoyers
- Original Message -
> From: "Michael Cree" 
> To: "Mathieu Desnoyers" 
> Cc: "Greg KH" , linux-al...@vger.kernel.org, 
> "Richard Henderson" , "Ivan
> Kokshaysky" , "Matt Turner" , 
> "Huang Ying" ,
> linux-kernel@vger.kernel.org, "Paul McKenney" , 
> "David Howells" ,
> "Pranith Kumar" , sta...@vger.kernel.org
> Sent: Saturday, February 7, 2015 7:47:29 PM
> Subject: Re: [PATCH] llist: Fix missing lockless_dereference()
> 
> On Sat, Feb 07, 2015 at 10:30:44PM +, Mathieu Desnoyers wrote:
> > > On Fri, Feb 06, 2015 at 09:08:21PM -0500, Mathieu Desnoyers wrote:
> > > > A lockless_dereference() appears to be missing in llist_del_first().
> > > > It should only matter for Alpha in practice.
> 
> What could one anticipate to be the symptoms of such a missing
> lockless_dereference()?

This can trigger corruption of the lockless linked-list, which is
used across a few subsystems. AFAIU, the scenario is as follows.
Please bear with me, because it's been a while since I've read on
the Alpha multi-cache-banks behavior.

The list here would be initially non-empty. Initial state of
new_last->next is unset (newly allocated); IOW: garbage. CPU A
adds a node into the list while CPU B removes a node from the
head of the list.

CPU A  CPU B
llist_add_batch()
- Stores to new_last->next
- implicit full mb before cmpxchg makes the
  update to CPU A's cache bank containing
  new_last->next visible to other CPUs
  before CPU A's cache bank update making
  head->first visible to other CPUs.
- cmpxchg updates head->first = new_first
   llist_del_first()
   - entry = load head->first
   -> here, lack of barrier on Alpha 
creates a window where
  CPU B's cache bank can see the 
updated "head->first",
  but the cache bank holding the 
next value did not
  receive the update yet, since 
each cache bank have
  their own channel, which can be 
independently
  saturated.
   - next = load entry->next 
(dereference entry pointer)
   - cmpxchg updates head->first = next
 -> can store unset "next" value 
into head->first, thus
corrupting the linked list.

> 
> The Alpha kernel is behaving pretty well provided one builds a machine
> specific kernel and UP.  When running an SMP kernel some packages
> (most notably the java runtime, but there are a few others) occasionally
> lock up in a pthread call --- could be a problem in libc rather then the
> kernel.

Are those lockups always occasional, or you have ways to reproduce them
frequently with stress-tests ?

Thanks,

Mathieu

> 
> > > Meta-comment, do we really care about Alpha anymore?  Is it still
> > > consered an "active" arch we support?
> 
> There are a few of us still running recent kernels on Alpha.  I am
> maintaining the unofficial Debian alpha port at debian-ports, and the
> Debian popcon shows about 10 installations of Debian Alpha.
> 
> Cheers
> Michael.
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH Resend] staging: speakup: Fix warning of line over 80 characters.

2015-02-07 Thread Shirish Gajera
This patch fixes the checkpatch.pl warning:

WARNING: line over 80 characters
All line over 80 characters in driver/staging/speakup/* are fixed.

Signed-off-by: Shirish Gajera 
---
 drivers/staging/speakup/main.c   | 12 
 drivers/staging/speakup/serialio.h   |  3 ++-
 drivers/staging/speakup/speakup.h|  6 --
 drivers/staging/speakup/speakup_decext.c |  6 --
 drivers/staging/speakup/speakup_decpc.c  |  6 --
 drivers/staging/speakup/spk_priv.h   |  3 ++-
 drivers/staging/speakup/spk_types.h  |  3 ++-
 7 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index e9f0c15..4af36ca 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -422,8 +422,10 @@ static void announce_edge(struct vc_data *vc, int msg_id)
 {
if (spk_bleeps & 1)
bleep(spk_y);
-   if ((spk_bleeps & 2) && (msg_id < edge_quiet))
-   synth_printf("%s\n", spk_msg_get(MSG_EDGE_MSGS_START + msg_id - 
1));
+   if ((spk_bleeps & 2) && (msg_id < edge_quiet)) {
+   synth_printf("%s\n",
+   spk_msg_get(MSG_EDGE_MSGS_START + msg_id - 1));
+   }
 }
 
 static void speak_char(u_char ch)
@@ -1131,7 +1133,8 @@ static void spkup_write(const char *in_buf, int count)
if (in_count > 2 && rep_count > 2) {
if (last_type & CH_RPT) {
synth_printf(" ");
-   synth_printf(spk_msg_get(MSG_REPEAT_DESC2), 
++rep_count);
+   synth_printf(spk_msg_get(MSG_REPEAT_DESC2),
+++rep_count);
synth_printf(" ");
}
rep_count = 0;
@@ -1847,7 +1850,8 @@ static void speakup_win_set(struct vc_data *vc)
win_right = spk_x;
}
snprintf(info, sizeof(info), spk_msg_get(MSG_WINDOW_BOUNDARY),
-(win_start) ? spk_msg_get(MSG_END) : 
spk_msg_get(MSG_START),
+(win_start) ? spk_msg_get(MSG_END) :
+  spk_msg_get(MSG_START),
 (int)spk_y + 1, (int)spk_x + 1);
}
synth_printf("%s\n", info);
diff --git a/drivers/staging/speakup/serialio.h 
b/drivers/staging/speakup/serialio.h
index 317bb84..1b39921 100644
--- a/drivers/staging/speakup/serialio.h
+++ b/drivers/staging/speakup/serialio.h
@@ -34,6 +34,7 @@ struct old_serial_port {
 #define SPK_TIMEOUT 100
 #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
 
-#define spk_serial_tx_busy() ((inb(speakup_info.port_tts + UART_LSR) & 
BOTH_EMPTY) != BOTH_EMPTY)
+#define spk_serial_tx_busy() \
+   ((inb(speakup_info.port_tts + UART_LSR) & BOTH_EMPTY) != BOTH_EMPTY)
 
 #endif
diff --git a/drivers/staging/speakup/speakup.h 
b/drivers/staging/speakup/speakup.h
index 898dce5..d194ebb 100644
--- a/drivers/staging/speakup/speakup.h
+++ b/drivers/staging/speakup/speakup.h
@@ -61,10 +61,12 @@ extern struct st_var_header *spk_get_var_header(enum 
var_id_t var_id);
 extern struct st_var_header *spk_var_header_by_name(const char *name);
 extern struct punc_var_t *spk_get_punc_var(enum var_id_t var_id);
 extern int spk_set_num_var(int val, struct st_var_header *var, int how);
-extern int spk_set_string_var(const char *page, struct st_var_header *var, int 
len);
+extern int spk_set_string_var(const char *page, struct st_var_header *var,
+ int len);
 extern int spk_set_mask_bits(const char *input, const int which, const int 
how);
 extern special_func spk_special_handler;
-extern int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short 
key);
+extern int spk_handle_help(struct vc_data *vc, u_char type, u_char ch,
+  u_short key);
 extern int synth_init(char *name);
 extern void synth_release(void);
 
diff --git a/drivers/staging/speakup/speakup_decext.c 
b/drivers/staging/speakup/speakup_decext.c
index 5550290..d86a579 100644
--- a/drivers/staging/speakup/speakup_decext.c
+++ b/drivers/staging/speakup/speakup_decext.c
@@ -207,10 +207,12 @@ static void do_catch_up(struct spk_synth *synth)
if (time_after_eq(jiffies, jiff_max)) {
if (!in_escape)
spk_serial_out(PROCSPEECH);
-   spin_lock_irqsave(_info.spinlock, 
flags);
+   spin_lock_irqsave(_info.spinlock,
+ flags);
jiffy_delta_val = jiffy_delta->u.n.value;
delay_time_val = delay_time->u.n.value;
-   spin_unlock_irqrestore(_info.spinlock, 
flags);
+   spin_unlock_irqrestore(_info.spinlock,
+  flags);
   

Re: [PATCH] brd: detect zero writes for saving ram

2015-02-07 Thread Akinobu Mita
2015-02-08 0:18 GMT+09:00 Akinobu Mita :
> 2015-02-08 0:03 GMT+09:00 Akinobu Mita :
>> This introduces a module parameter to detect zero writes and not to
>> allocate memory.  Read requests for unallocated (unwritten) region
>> end up by reading zero.  So this can save zeroed memory consumption
>> with extra overhead for the detection.
>>
>> This feature is useful for testing filesystems and user programs to
>> huge files without huge real storage.  So this change also extends
>> the upper limit on the size of the RAM disk.
>
> I have just noticed about zram and I'll check I can use it instead.

zram currently needs to allocate memory proportional to the size of
the disk ((disksize >> PAGE_SHIFT) * sizeof(struct zram_table_entry)).
If disksize is TB or PB class, it requires huge amount of memory.
But brd with this patch can create 1PB filesystem.  So there is a
reason for this new brd feature to exist.

# modprobe brd zero_detect=1 rd_size=$((1024*1024*1024*1024))
# mkfs.xfs /dev/ram0
# mount /dev/ram0 /mnt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC PATCH 3/8] kmod - teach call_usermodehelper() to use a namespace

2015-02-07 Thread Ian Kent
On Fri, 2015-02-06 at 07:08 -0500, Jeff Layton wrote:
> On Thu, 05 Feb 2015 10:34:11 +0800
> Ian Kent  wrote:
> 
> > The call_usermodehelper() function executes all binaries in the
> > global "init" root context. This doesn't allow a binary to be run
> > within a namespace (eg. the namespace of a container).
> > 
> > Both containerized NFS client and NFS server need the ability to
> > execute a binary in a container's context. To do this use the init
> > process of the callers environment is used to setup the namespaces
> > in the same way the root init process is used otherwise.
> > 
> > Signed-off-by: Ian Kent 
> > Cc: Benjamin Coddington 
> > Cc: Al Viro 
> > Cc: J. Bruce Fields 
> > Cc: David Howells 
> > Cc: Trond Myklebust 
> > Cc: Oleg Nesterov 
> > Cc: Eric W. Biederman 
> > Cc: Jeff Layton 
> > ---
> >  include/linux/kmod.h |   16 +++
> >  kernel/kmod.c|  115 
> > +-
> >  2 files changed, 128 insertions(+), 3 deletions(-)
> > 
> > diff --git a/include/linux/kmod.h b/include/linux/kmod.h
> > index 15bdeed..b0f1b3c 100644
> > --- a/include/linux/kmod.h
> > +++ b/include/linux/kmod.h
> > @@ -52,6 +52,7 @@ struct file;
> >  #define UMH_WAIT_EXEC  1   /* wait for the exec, but not the 
> > process */
> >  #define UMH_WAIT_PROC  2   /* wait for the process to complete */
> >  #define UMH_KILLABLE   4   /* wait for EXEC/PROC killable */
> > +#define UMH_USE_NS 8   /* exec using caller's init namespace */
> >  
> >  struct subprocess_info {
> > struct work_struct work;
> > @@ -69,6 +70,21 @@ struct subprocess_info {
> >  extern int
> >  call_usermodehelper(char *path, char **argv, char **envp, int flags);
> >  
> > +#if !defined(CONFIG_PROC_FS) || !defined(CONFIG_NAMESPACES)
> > +inline struct task_struct *umh_get_init_task(void)
> > +{
> > +   return ERR_PTR(-ENOTSUP);
> > +}
> > +
> > +inline int umh_enter_ns(struct task_struct *tsk, struct cred *new)
> > +{
> > +   return -ENOTSUP;
> > +}
> > +#else
> > +struct task_struct *umh_get_init_pid(void);
> > +int umh_enter_ns(struct task_struct *tsk, struct cred *new);
> > +#endif
> > +
> >  extern struct subprocess_info *
> >  call_usermodehelper_setup(char *path, char **argv, char **envp, gfp_t 
> > gfp_mask,
> >   int (*init)(struct subprocess_info *info, struct cred 
> > *new),
> > diff --git a/kernel/kmod.c b/kernel/kmod.c
> > index 14c0188..4c649d6 100644
> > --- a/kernel/kmod.c
> > +++ b/kernel/kmod.c
> > @@ -582,6 +582,98 @@ unlock:
> >  }
> >  EXPORT_SYMBOL(call_usermodehelper_exec);
> >  
> > +#if defined(CONFIG_PROC_FS) && defined(CONFIG_NAMESPACES)
> > +#define NS_PATH_MAX35
> > +#define NS_PATH_FMT"%lu/ns/%s"
> > +
> > +/* Note namespace name order is significant */
> > +static const char *ns_names[] = { "user", "ipc", "uts", "net", "pid", 
> > "mnt", NULL };
> > +
> > +struct task_struct *umh_get_init_pid(void)
> 
> nit: we're not getting a pid here but a task_struct pointer. Maybe this
> should be called umh_get_init_task?

Ha, yep.

> 
> > +{
> > +   struct task_struct *tsk;
> > +
> > +   rcu_read_lock();
> > +   tsk = find_task_by_vpid(1);
> > +   if (tsk)
> > +   get_task_struct(tsk);
> > +   rcu_read_unlock();
> 
> I'm not terribly familiar with the task_struct lifetime rules...
> 
> I assume that you can be assured that tsk won't go away while you hold
> the rcu_read_lock, but is doing a get_task_struct while holding it
> sufficient to pin it after you drop the lock?
> 
> IOW, could the refcount on the task_struct do a 0->1 transition here and
> end up being freed anyway after you've grabbed a reference?

Good point, I thought getting a reference under he read lock would be
enough but maybe I need more checks as I do with dentrys. I'll check
that.

Ian

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] staging: speakup: Fix warning of line over 80 characters.

2015-02-07 Thread Greg KH
On Sat, Feb 07, 2015 at 06:34:39PM -0800, shirish gajera wrote:
> On Sat, Feb 7, 2015 at 4:33 PM, Greg KH  wrote:
> 
> On Sat, Feb 07, 2015 at 09:46:37AM -0800, shirish gajera wrote:
> > On Sat, Feb 7, 2015 at 1:09 AM, Greg KH 
> wrote:
> >
> >     On Sat, Jan 31, 2015 at 02:19:43PM -0800, Shirish Gajera wrote:
> >     > This patch fixes the checkpatch.pl warning:
> >     >
> >     > WARNING: line over 80 characters
> >     >
> >     > All line over 80 characters in driver/staging/speakup/* are fixed.
> >     > Aditional changes suggest by mailing list are also fixed.
> >     >
> >     > Signed-off-by: Shirish Gajera 
> >     > ---
> >     >  drivers/staging/speakup/main.c           | 12 
> >     >  drivers/staging/speakup/serialio.h       |  3 ++-
> >     >  drivers/staging/speakup/speakup.h        |  6 --
> >     >  drivers/staging/speakup/speakup_decext.c |  6 --
> >     >  drivers/staging/speakup/speakup_decpc.c  |  6 --
> >     >  drivers/staging/speakup/spk_priv.h       |  3 ++-
> >     >  drivers/staging/speakup/spk_types.h      |  3 ++-
> >     >  drivers/staging/speakup/synth.c          | 10 +-
> >     >  8 files changed, 31 insertions(+), 18 deletions(-)
> >
> >     This fails to apply to my tree for some reason :(
> >
> >     Can you refresh it and resend?
> >
> >     thanks,
> >
> >     greg k-h
> >
> >
> >
> > It is already refreshed from last time. 
> >
> > Can you clarify refresh means git pull and resend right ? Is there any
> other
> > way of refresh ?
> 
> Yes it does.  What tree and branch are you making these against?  They
> should be against my staging.git tree on git.kernel.org, and against the
> staging-testing branch.  Anything else might have conflicts.
> 
> thanks,
> 
> greg k-h
> 
> 
> I clone this directory git clone -b staging-next git://git.kernel.org/pub/scm/
> linux/kernel/git/gregkh/staging.git So, I am hoping it's pointing to your 
> tree.

Yes it is.

> I still didn't understand what staging-testing branch is ? Also I can check if
> there is some conflicts. I check this one http://
> driverdev.linuxdriverproject.org/pipermail/driverdev-devel/ for january and
> February I don't see any conflicts.
> 
> Can you elaborate more why it's failing ?

I can't dig through your web link, but if you don't know about git
branches, then odds are you are making this against the wrong set of
code.

Read up some tutorials on git that describe how to work with branches,
that should help out.

A short example of what to do might be:
    git clone -b staging-next 
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
cd staging
git checkout -t -b staging-testing origin/staging-testing
git chekout -b work


that will create a local branch called "staging-testing" that will track
my upstream staging-testing, and a local branch for you to work on
called "work".  Then diff between work and staging-testing and you
should be all set.

Hope this helps,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] Staging: fbtft: Fix Sparse warnings

2015-02-07 Thread Frederic Jacob
This fixes the folowing sparse warnings:

fb_hx8340bn.c:111:6: warning: symbol 'set_addr_win' was not declared. Should it 
be static?
fbtft_device.c:32:19: warning: symbol 'spi_device' was not declared. Should it 
be static?
fbtft_device.c:33:24: warning: symbol 'p_device' was not declared. Should it be 
static?

Signed-off-by: Frederic Jacob 
---
Corrected the changelog to specify the fixed Sparse warnings.
 drivers/staging/fbtft/fb_hx8340bn.c  | 2 +-
 drivers/staging/fbtft/fbtft_device.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_hx8340bn.c 
b/drivers/staging/fbtft/fb_hx8340bn.c
index 3939502..26a987a 100644
--- a/drivers/staging/fbtft/fb_hx8340bn.c
+++ b/drivers/staging/fbtft/fb_hx8340bn.c
@@ -108,7 +108,7 @@ static int init_display(struct fbtft_par *par)
return 0;
 }
 
-void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
+static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
 {
fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par,
"%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", __func__, xs, ys, xe, ye);
diff --git a/drivers/staging/fbtft/fbtft_device.c 
b/drivers/staging/fbtft/fbtft_device.c
index b9f4c30..157f79c 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -29,8 +29,8 @@
 
 #define MAX_GPIOS 32
 
-struct spi_device *spi_device;
-struct platform_device *p_device;
+static struct spi_device *spi_device;
+static struct platform_device *p_device;
 
 static char *name;
 module_param(name, charp, 0);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] llist: Fix missing lockless_dereference()

2015-02-07 Thread Greg KH
On Sun, Feb 08, 2015 at 02:12:04PM +1300, Michael Cree wrote:
> On Sun, Feb 08, 2015 at 08:59:41AM +0800, Greg KH wrote:
> > On Sun, Feb 08, 2015 at 01:47:29PM +1300, Michael Cree wrote:
> > > On Sat, Feb 07, 2015 at 10:30:44PM +, Mathieu Desnoyers wrote:
> > > > > On Fri, Feb 06, 2015 at 09:08:21PM -0500, Mathieu Desnoyers wrote:
> > > > > > A lockless_dereference() appears to be missing in llist_del_first().
> > > > > > It should only matter for Alpha in practice.
> > > 
> > > What could one anticipate to be the symptoms of such a missing
> > > lockless_dereference()?
> > > 
> > > The Alpha kernel is behaving pretty well provided one builds a machine
> > > specific kernel and UP.  When running an SMP kernel some packages
> > > (most notably the java runtime, but there are a few others) occasionally
> > > lock up in a pthread call --- could be a problem in libc rather then the
> > > kernel.
> > 
> > Hm, if only UP alpha needs to be supported, odds are we could rip a lot
> > of odd stuff out of the kernel that deals with memory barriers and other
> > nasty locking things that the Alpha requires.
> > 
> > Would that be ok?  Or is someone somewhere going to want to be running a
> > SMP kernel on Alpha in the future?
> 
> I am running an SMP kernel on a 3-cpu Alpha system; it mostly works
> just fine.
> 
> I was just noting that there is something up with java---it locks up
> occassionally in a pthread call, and there are a few other packages
> that occasionally fail in test suites when being built under an SMP
> kernel but always pass when built under an UP kernel which suggests
> there is a little buglet somewhere in the SMP code, either in the
> kernel or in libc.
> 
> Running an SMP system for the Debian Alpha build daemon at debian-ports
> is really useful for keeping up with the other architectures.

Ok, sorry, I got the impression that you weren't running a SMP kernel,
nevermind then, we'll go back to keeping this ancient beast alive :)

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] llist: Fix missing lockless_dereference()

2015-02-07 Thread Michael Cree
On Sun, Feb 08, 2015 at 08:59:41AM +0800, Greg KH wrote:
> On Sun, Feb 08, 2015 at 01:47:29PM +1300, Michael Cree wrote:
> > On Sat, Feb 07, 2015 at 10:30:44PM +, Mathieu Desnoyers wrote:
> > > > On Fri, Feb 06, 2015 at 09:08:21PM -0500, Mathieu Desnoyers wrote:
> > > > > A lockless_dereference() appears to be missing in llist_del_first().
> > > > > It should only matter for Alpha in practice.
> > 
> > What could one anticipate to be the symptoms of such a missing
> > lockless_dereference()?
> > 
> > The Alpha kernel is behaving pretty well provided one builds a machine
> > specific kernel and UP.  When running an SMP kernel some packages
> > (most notably the java runtime, but there are a few others) occasionally
> > lock up in a pthread call --- could be a problem in libc rather then the
> > kernel.
> 
> Hm, if only UP alpha needs to be supported, odds are we could rip a lot
> of odd stuff out of the kernel that deals with memory barriers and other
> nasty locking things that the Alpha requires.
> 
> Would that be ok?  Or is someone somewhere going to want to be running a
> SMP kernel on Alpha in the future?

I am running an SMP kernel on a 3-cpu Alpha system; it mostly works
just fine.

I was just noting that there is something up with java---it locks up
occassionally in a pthread call, and there are a few other packages
that occasionally fail in test suites when being built under an SMP
kernel but always pass when built under an UP kernel which suggests
there is a little buglet somewhere in the SMP code, either in the
kernel or in libc.

Running an SMP system for the Debian Alpha build daemon at debian-ports
is really useful for keeping up with the other architectures.

Cheers
Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] llist: Fix missing lockless_dereference()

2015-02-07 Thread Michael Cree
On Sat, Feb 07, 2015 at 10:30:44PM +, Mathieu Desnoyers wrote:
> > On Fri, Feb 06, 2015 at 09:08:21PM -0500, Mathieu Desnoyers wrote:
> > > A lockless_dereference() appears to be missing in llist_del_first().
> > > It should only matter for Alpha in practice.

What could one anticipate to be the symptoms of such a missing
lockless_dereference()?

The Alpha kernel is behaving pretty well provided one builds a machine
specific kernel and UP.  When running an SMP kernel some packages
(most notably the java runtime, but there are a few others) occasionally
lock up in a pthread call --- could be a problem in libc rather then the
kernel.

> > Meta-comment, do we really care about Alpha anymore?  Is it still
> > consered an "active" arch we support? 

There are a few of us still running recent kernels on Alpha.  I am
maintaining the unofficial Debian alpha port at debian-ports, and the
Debian popcon shows about 10 installations of Debian Alpha.

Cheers
Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] tracing: Add condition check to RCU lockdep checks

2015-02-07 Thread Steven Rostedt
From: "Steven Rostedt (Red Hat)" 

The trace_tlb_flush() tracepoint can be called when a CPU is going offline.
When a CPU is offline, RCU is no longer watching that CPU and since the
tracepoint is protected by RCU, it must not be called. To prevent the
tlb_flush tracepoint from being called when the CPU is offline, it was
converted to a TRACE_EVENT_CONDITION where the condition checks if the
CPU is online before calling the tracepoint.

Unfortunately, this was not enough to stop lockdep from complaining about
it. Even though the RCU protected code of the tracepoint will never be
called, the condition is hidden within the tracepoint, and even though the
condition prevents RCU code from being called, the lockdep checks are
outside the tracepoint (this is to test tracepoints even when they are not
enabled).

Even though tracepoints should be checked to be RCU safe when they are not
enabled, the condition should still be considered when checking RCU.

Link: 
http://lkml.kernel.org/r/CA+icZUUGiGDoL5NU8RuxKzFjoLjEKRtUWx=jb8b9a0eqv-e...@mail.gmail.com

Fixes: 3a630178fd5f "tracing: generate RCU warnings even when tracepoints are 
disabled"
Cc: sta...@vger.kernel.org # 3.18+
Acked-by: Dave Hansen 
Reported-by: Sedat Dilek 
Tested-by: Sedat Dilek 
Signed-off-by: Steven Rostedt 
---
 include/linux/tracepoint.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index e08e21e5f601..c72851328ca9 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -173,7 +173,7 @@ extern void syscall_unregfunc(void);
TP_PROTO(data_proto),   \
TP_ARGS(data_args), \
TP_CONDITION(cond),,);  \
-   if (IS_ENABLED(CONFIG_LOCKDEP)) {   \
+   if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \
rcu_read_lock_sched_notrace();  \
rcu_dereference_sched(__tracepoint_##name.funcs);\
rcu_read_unlock_sched_notrace();\
-- 
2.1.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] x86/tlb/trace: Do not trace on CPU that is offline

2015-02-07 Thread Steven Rostedt
From: "Steven Rostedt (Red Hat)" 

When taking a CPU down for suspend and resume, a tracepoint may be called
when the CPU has been designated offline. As tracepoints require RCU for
protection, they must not be called if the current CPU is offline.

Unfortunately, trace_tlb_flush() is called in this scenario as was noted
by LOCKDEP:

...

 Disabling non-boot CPUs ...
 intel_pstate CPU 1 exiting

 ===
 smpboot: CPU 1 didn't die...
 [ INFO: suspicious RCU usage. ]
 3.19.0-rc7-next-20150204.1-iniza-small #1 Not tainted
 ---
 include/trace/events/tlb.h:35 suspicious rcu_dereference_check() usage!

 other info that might help us debug this:

 RCU used illegally from offline CPU!
 rcu_scheduler_active = 1, debug_locks = 0
 no locks held by swapper/1/0.

 stack backtrace:
 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 
3.19.0-rc7-next-20150204.1-iniza-small #1
 Hardware name: SAMSUNG ELECTRONICS CO., LTD. 
530U3BI/530U4BI/530U4BH/530U3BI/530U4BI/530U4BH, BIOS 13XK 03/28/2013
  0001 88011a44fe18 817e370d 0011
  88011a448290 88011a44fe48 810d6847 8800c66b9600
  0001 88011a44c000 81cb3900 88011a44fe78
 Call Trace:
  [] dump_stack+0x4c/0x65
  [] lockdep_rcu_suspicious+0xe7/0x120
  [] idle_task_exit+0x205/0x2c0
  [] play_dead_common+0xe/0x50
  [] native_play_dead+0x15/0x140
  [] arch_cpu_idle_dead+0xf/0x20
  [] cpu_startup_entry+0x37e/0x580
  [] start_secondary+0x140/0x150
 intel_pstate CPU 2 exiting

...

By converting the tlb_flush tracepoint to a TRACE_EVENT_CONDITION where the
condition is cpu_online(smp_processor_id()), we can avoid calling RCU protected
code when the CPU is offline.

Link: 
http://lkml.kernel.org/r/CA+icZUUGiGDoL5NU8RuxKzFjoLjEKRtUWx=jb8b9a0eqv-e...@mail.gmail.com

Cc: sta...@vger.kernel.org # 3.17+
Fixes: d17d8f9dedb9 "x86/mm: Add tracepoints for TLB flushes"
Reported-by: Sedat Dilek 
Tested-by: Sedat Dilek 
Suggested-by: Paul E. McKenney 
Acked-by: Paul E. McKenney 
Acked-by: Dave Hansen 
Signed-off-by: Steven Rostedt 
---
 include/trace/events/tlb.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/trace/events/tlb.h b/include/trace/events/tlb.h
index 13391d288107..0e7635765153 100644
--- a/include/trace/events/tlb.h
+++ b/include/trace/events/tlb.h
@@ -13,11 +13,13 @@
{ TLB_LOCAL_SHOOTDOWN,  "local shootdown" },\
{ TLB_LOCAL_MM_SHOOTDOWN,   "local mm shootdown" }
 
-TRACE_EVENT(tlb_flush,
+TRACE_EVENT_CONDITION(tlb_flush,
 
TP_PROTO(int reason, unsigned long pages),
TP_ARGS(reason, pages),
 
+   TP_CONDITION(cpu_online(smp_processor_id())),
+
TP_STRUCT__entry(
__field(  int, reason)
__field(unsigned long,  pages)
-- 
2.1.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] llist: Fix missing lockless_dereference()

2015-02-07 Thread Greg KH
On Sun, Feb 08, 2015 at 01:47:29PM +1300, Michael Cree wrote:
> On Sat, Feb 07, 2015 at 10:30:44PM +, Mathieu Desnoyers wrote:
> > > On Fri, Feb 06, 2015 at 09:08:21PM -0500, Mathieu Desnoyers wrote:
> > > > A lockless_dereference() appears to be missing in llist_del_first().
> > > > It should only matter for Alpha in practice.
> 
> What could one anticipate to be the symptoms of such a missing
> lockless_dereference()?
> 
> The Alpha kernel is behaving pretty well provided one builds a machine
> specific kernel and UP.  When running an SMP kernel some packages
> (most notably the java runtime, but there are a few others) occasionally
> lock up in a pthread call --- could be a problem in libc rather then the
> kernel.

Hm, if only UP alpha needs to be supported, odds are we could rip a lot
of odd stuff out of the kernel that deals with memory barriers and other
nasty locking things that the Alpha requires.

Would that be ok?  Or is someone somewhere going to want to be running a
SMP kernel on Alpha in the future?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/2] [GIT PULL] tracing: Fix tlb_flush TP called in RCU ignored location

2015-02-07 Thread Steven Rostedt

Linus,

During testing Sedat Dilek hit a "suspicious RCU usage" splat that pointed
out a real bug. During suspend and resume the tlb_flush tracepoint is
called when the CPU is going offline. As the CPU has been noted as offline,
RCU is ignoring that CPU, which means that it can not use RCU protected
locks. When tracepoints are activated, they require RCU locking, and
if RCU is ignoring a CPU that runs a tracepoint, there is a chance that
the tracepoint could cause corruption.

The solution was to change the tracepoint into a TRACE_EVENT_CONDITION()
which allows us to check a condition to determine if the tracepoint
should be called or not. If the condition is not met, the rcu protected
code will not be executed. By adding the condition
"cpu_online(smp_processor_id())", this will prevent the RCU protected
code from being executed if the CPU is marked offline.

After adding this, another bug was discovered. As RCU checks rcu callers,
if a rcu call is not done, there is no check (obviously). We found that
tracepoints could be added in RCU ignored locations and not have lockdep
complain until the tracepoint is activated. This missed places where
tracepoints were added in places they should not have been. To fix this,
code was added in 3.18 that if lockdep is enabled, any tracepoint will
still call the rcu checks even if the tracepoint is not enabled. The bug
here, is that the check does not take the CONDITION into account. As the
condition may prevent tracepoints from being activated in RCU ignored
areas (as the one patch does), we get false positives when we enable
lockdep and hit a tracepoint that the condition prevents it from being
called in a RCU ignored location. The fix for this is to add the
CONDITION to the rcu checks, even if the tracepoint is not enabled.

Please pull the latest trace-fixes-v3.19-rc7 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
trace-fixes-v3.19-rc7

Tag SHA1: 8c1c683d0b8af59da6b65976bb7f2a2f1cac7345
Head SHA1: 6c8465a82a605bc692304bab42703017dcfff013


Steven Rostedt (Red Hat) (2):
  tracing: Add condition check to RCU lockdep checks
  x86/tlb/trace: Do not trace on CPU that is offline


 include/linux/tracepoint.h | 2 +-
 include/trace/events/tlb.h | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] staging: speakup: Fix warning of line over 80 characters.

2015-02-07 Thread Greg KH
On Sat, Feb 07, 2015 at 09:46:37AM -0800, shirish gajera wrote:
> On Sat, Feb 7, 2015 at 1:09 AM, Greg KH  wrote:
> 
> On Sat, Jan 31, 2015 at 02:19:43PM -0800, Shirish Gajera wrote:
> > This patch fixes the checkpatch.pl warning:
> >
> > WARNING: line over 80 characters
> >
> > All line over 80 characters in driver/staging/speakup/* are fixed.
> > Aditional changes suggest by mailing list are also fixed.
> >
> > Signed-off-by: Shirish Gajera 
> > ---
> >  drivers/staging/speakup/main.c           | 12 
> >  drivers/staging/speakup/serialio.h       |  3 ++-
> >  drivers/staging/speakup/speakup.h        |  6 --
> >  drivers/staging/speakup/speakup_decext.c |  6 --
> >  drivers/staging/speakup/speakup_decpc.c  |  6 --
> >  drivers/staging/speakup/spk_priv.h       |  3 ++-
> >  drivers/staging/speakup/spk_types.h      |  3 ++-
> >  drivers/staging/speakup/synth.c          | 10 +-
> >  8 files changed, 31 insertions(+), 18 deletions(-)
> 
> This fails to apply to my tree for some reason :(
> 
> Can you refresh it and resend?
> 
> thanks,
> 
> greg k-h
> 
> 
> 
> It is already refreshed from last time. 
> 
> Can you clarify refresh means git pull and resend right ? Is there any other
> way of refresh ?

Yes it does.  What tree and branch are you making these against?  They
should be against my staging.git tree on git.kernel.org, and against the
staging-testing branch.  Anything else might have conflicts.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] llist: Fix missing lockless_dereference()

2015-02-07 Thread Greg KH
On Sat, Feb 07, 2015 at 04:18:14PM -0800, Matt Turner wrote:
> On Sat, Feb 7, 2015 at 2:30 PM, Mathieu Desnoyers
>  wrote:
> > - Original Message -
> >> From: "Greg KH" 
> >> To: "Mathieu Desnoyers" 
> >> Cc: "Huang Ying" , linux-kernel@vger.kernel.org, 
> >> "Paul McKenney" ,
> >> "David Howells" , "Pranith Kumar" 
> >> , sta...@vger.kernel.org
> >> Sent: Saturday, February 7, 2015 5:16:25 PM
> >> Subject: Re: [PATCH] llist: Fix missing lockless_dereference()
> >>
> >> On Fri, Feb 06, 2015 at 09:08:21PM -0500, Mathieu Desnoyers wrote:
> >> > A lockless_dereference() appears to be missing in llist_del_first().
> >> > It should only matter for Alpha in practice.
> >>
> >> Meta-comment, do we really care about Alpha anymore?  Is it still
> >> consered an "active" arch we support?  I haven't seen a single
> >> alpha-related stable patch in _years_ if at all, which implies to me
> >> that no one is even using it.
> >>
> >> Not that stable patches for architectures are a valid reference for how
> >> much they are used, but it does give me a good indication of what arches
> >> have users that actually care about a modern (i.e. within the past 5
> >> years) kernel.
> >
> > Good question. Adding the Alpha maintainers to the CC.
> >
> > Thanks,
> >
> > Mathieu
> 
> Hello,
> 
> Yes, Gentoo has a maintained Alpha port. We care about having modern
> kernels (though I have not personally had a lot of time to work on
> that recently)

Ok, fair enough, thanks for letting me know.  I guess we can't drop it
just yet :)

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] llist: Fix missing lockless_dereference()

2015-02-07 Thread Matt Turner
On Sat, Feb 7, 2015 at 2:30 PM, Mathieu Desnoyers
 wrote:
> - Original Message -
>> From: "Greg KH" 
>> To: "Mathieu Desnoyers" 
>> Cc: "Huang Ying" , linux-kernel@vger.kernel.org, "Paul 
>> McKenney" ,
>> "David Howells" , "Pranith Kumar" 
>> , sta...@vger.kernel.org
>> Sent: Saturday, February 7, 2015 5:16:25 PM
>> Subject: Re: [PATCH] llist: Fix missing lockless_dereference()
>>
>> On Fri, Feb 06, 2015 at 09:08:21PM -0500, Mathieu Desnoyers wrote:
>> > A lockless_dereference() appears to be missing in llist_del_first().
>> > It should only matter for Alpha in practice.
>>
>> Meta-comment, do we really care about Alpha anymore?  Is it still
>> consered an "active" arch we support?  I haven't seen a single
>> alpha-related stable patch in _years_ if at all, which implies to me
>> that no one is even using it.
>>
>> Not that stable patches for architectures are a valid reference for how
>> much they are used, but it does give me a good indication of what arches
>> have users that actually care about a modern (i.e. within the past 5
>> years) kernel.
>
> Good question. Adding the Alpha maintainers to the CC.
>
> Thanks,
>
> Mathieu

Hello,

Yes, Gentoo has a maintained Alpha port. We care about having modern
kernels (though I have not personally had a lot of time to work on
that recently)

Thanks,
Matt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] llist: Fix missing lockless_dereference()

2015-02-07 Thread Paul E. McKenney
On Sun, Feb 08, 2015 at 06:16:25AM +0800, Greg KH wrote:
> On Fri, Feb 06, 2015 at 09:08:21PM -0500, Mathieu Desnoyers wrote:
> > A lockless_dereference() appears to be missing in llist_del_first().
> > It should only matter for Alpha in practice.
> 
> Meta-comment, do we really care about Alpha anymore?  Is it still
> consered an "active" arch we support?  I haven't seen a single
> alpha-related stable patch in _years_ if at all, which implies to me
> that no one is even using it.
> 
> Not that stable patches for architectures are a valid reference for how
> much they are used, but it does give me a good indication of what arches
> have users that actually care about a modern (i.e. within the past 5
> years) kernel.

I get a reasonable number of objections whenever I suggest something that
would cause problems for Alpha.  That said, my most recent suggestion
turns out to be mandated by recent versions of the C standard, so I think
that they have no choice but to get their compiler back-ends up to snuff.

(Before C11, a C compiler could legally compile a byte store as a
non-atomic read-modify-write sequence on the surrounding 32-bit quantity.
C11 and later outlaw this practice because it can introduce data races,
even in programs that use nothing but locking for synchronization.
The fix for this was introduced into gcc 4.7.)

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] net: bluetooth: hci_sock: Use 'const u32 *' instead of 'void *' for 2nd parameter of hci_test_bit()

2015-02-07 Thread Chen Gang S
On 2/8/15 03:52, Joe Perches wrote:
> On Sat, 2015-02-07 at 21:24 +0800, Chen Gang S wrote:
>> hci_test_bit() does not modify 2nd parameter, so it is better to let it
>> be constant, or may cause build warning. The related warning (with
>> allmodconfig under xtensa):
>>
>>   net/bluetooth/hci_sock.c: In function 'hci_sock_sendmsg':
>>   net/bluetooth/hci_sock.c:955:8: warning: passing argument 2 of 
>> 'hci_test_bit' discards 'const' qualifier from pointer target type 
>> [-Wdiscarded-array-qualifiers]
>>   _sec_filter.ocf_mask[ogf])) &&
>>   ^
>>   net/bluetooth/hci_sock.c:49:19: note: expected 'void *' but argument is of 
>> type 'const __u32 (*)[4] {aka const unsigned int (*)[4]}'
>>static inline int hci_test_bit(int nr, void *addr)
>>  ^
>>
>> hci_test_bit() always treats 2nd parameter is u32, and all callers also
>> know about it, so 2nd parameter of hci_test_bit() need use 'const u32 *'
>> instead of 'void *'.
>>
>> C language treats the array function parameter as a pointer, so the
>> caller need not use '&' for the 2 demotion array, or it reports warning:
>> 'const unsigned int (*)[4]' is different with 'const unsigned int *'.
> 
> I still think you are possibly papering over potential bugs
> on big-endian 64 bit systems.
> 
> unsigned long vs u32.
> 
> How are the bits actually set?
> 

>From current usage of event_mask, "(u32 *) f->event_mask" is only for
event_mask data storage, not for calculation (always as "u32 *" for
calculation).

  [root@localhost linux-next]# grep -rn "\" include/net/bluetooth 
net/bluetooth
  include/net/bluetooth/hci_sock.h:51:  unsigned long event_mask[2];
  include/net/bluetooth/hci_sock.h:57:  __u32  event_mask[2];
  net/bluetooth/hci_sock.c:59:  __u32 event_mask[2];
  net/bluetooth/hci_sock.c:110: if (!hci_test_bit(flt_event, (u32 
*)>event_mask))
  net/bluetooth/hci_sock.c:1041:uf.event_mask[0] = 
*((u32 *) f->event_mask + 0);
  net/bluetooth/hci_sock.c:1042:uf.event_mask[1] = 
*((u32 *) f->event_mask + 1);
  net/bluetooth/hci_sock.c:1053:uf.event_mask[0] &= 
*((u32 *) hci_sec_filter.event_mask + 0);
  net/bluetooth/hci_sock.c:1054:uf.event_mask[1] &= 
*((u32 *) hci_sec_filter.event_mask + 1);
  net/bluetooth/hci_sock.c:1062:*((u32 *) f->event_mask 
+ 0) = uf.event_mask[0];
  net/bluetooth/hci_sock.c:1063:*((u32 *) f->event_mask 
+ 1) = uf.event_mask[1];
  net/bluetooth/hci_sock.c:1124:uf.event_mask[0] = 
*((u32 *) f->event_mask + 0);
  net/bluetooth/hci_sock.c:1125:uf.event_mask[1] = 
*((u32 *) f->event_mask + 1);

Calculation is machine endian dependency, but event_mask is always as
"u32 *" for calculation, so there is no any type cast for calculation,
it is OK.

Storage is independent from machine endian, but it depends on machine
bits. In our case, 'unsigned long' array has enough space to accept u32
array, so there is no any data overwritten, it is OK.


By the way, I intended to remain event_mask as 'unsigned long' type,
because I am not quite sure whether it is also used by another modules
in kernel (or any other systems). May we change it to u32?

Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86/tbl/trace: Do not trace on CPU that is offline

2015-02-07 Thread Dave Hansen
Feel free to add to the pair:

Acked-by: Dave Hansen 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] vxlan: Wrong type passed to %pIS

2015-02-07 Thread Cong Wang
On Sat, Feb 7, 2015 at 4:34 AM, Rasmus Villemoes
 wrote:
> On Sat, Feb 07 2015, Cong Wang  wrote:
>
>> On Fri, Feb 6, 2015 at 6:17 PM, Rasmus Villemoes
>>  wrote:
>>> src_ip is a pointer to a union vxlan_addr, one member of which is a
>>> struct sockaddr. Passing a pointer to src_ip is wrong; one should pass
>>> the value of src_ip itself. Since %pIS formally expects something of
>>> type struct sockaddr*, let's pass a pointer to the appropriate union
>>> member, though this of course doesn't change the generated code.
>>>
>>
>>
>> It is a union, this doesn't harm.
>>
>
> Just to be clear: This fixes a real bug. The minimal fix had been
>
> - src_mac, >remote_ip, _ip);
> + src_mac, >remote_ip, src_ip);
>
> but I through in the cosmetic improvements while the line needed
> changing anyway.
>

Ah, I misread the patch.

Acked-by: Cong Wang 

Thanks!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Please respond!!!

2015-02-07 Thread Antonio Vinal
Hello friend!

I would like to contact you personally for an important proposal that could of 
interest to you.
I send this email only to know if this email address is functional.
I have something very important to discuss with you. Contact me for details by: 
 Email: fernrodyu...@aol.jp with your direct contacts.

Kind regards.
Antonio Vi?al.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: mmc does not work in qemu n900

2015-02-07 Thread Pali Rohár
On Friday 30 January 2015 15:23:34 Pali Rohár wrote:
> On Tuesday 27 January 2015 10:17:39 Pali Rohár wrote:
> > On Tuesday 27 January 2015 00:21:04 Aaro Koskinen wrote:
> > > Hi,
> > > 
> > > On Mon, Jan 26, 2015 at 10:04:59PM +0100, Pali Rohár wrote:
> > > > problem? Why any of these two patches fix problem when
> > > > mmc is not detected by kernel in qemu (machine n900)?
> > > > Detection of mmc fails because function
> > > > mmc_send_op_cond() without one of above patches fails.
> > > 
> > > Has it ever worked? It could be just that QEMU's emulation
> > > is broken. Since the kernel works on actual HW, you
> > > probably should contact QEMU maintainers.
> > > 
> > > I don't see n900 in Debian's QEMU. There's n800 and n810
> > > but I couldn't boot any of my kernels with those...
> > > 
> > > A.
> > 
> > It worked with stock Nokia kernel (2.6.28).
> > 
> > N900 qemu support is not in upstream qemu project, but in
> > linaro qemu version. You can find it e.g. in ubuntu:
> > http://packages.ubuntu.com/source/precise-updates/qemu-linar
> > o
> 
> Here is another alternative patch which enable internal eMMC
> support in qemu n900:
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 9584bff..225df49 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2330,13 +2330,13 @@ static int mmc_rescan_try_freq(struct
> mmc_host *host, unsigned freq)
>   sdio_reset(host);
>   mmc_go_idle(host);
> 
> - mmc_send_if_cond(host, host->ocr_avail);
> -
> - /* Order's important: probe SDIO, then SD, then MMC */
> - if (!mmc_attach_sdio(host))
> - return 0;
> - if (!mmc_attach_sd(host))
> - return 0;
> +//   mmc_send_if_cond(host, host->ocr_avail);
> +//
> +//   /* Order's important: probe SDIO, then SD, then MMC */
> +//   if (!mmc_attach_sdio(host))
> +//   return 0;
> +//   if (!mmc_attach_sd(host))
> +//   return 0;
>   if (!mmc_attach_mmc(host))
>   return 0;
> 
> It just disable SDIO and SD code. It looks like using some
> SDIO or SD commands on mmc controller in qemu cause
> problems...
> 
> Any idea?

Pavel, see this email thread:
http://www.spinics.net/lists/linux-mmc/msg30424.html

You had problem with mounting mmc device as rootfs on (real) 
Nokia N900. Can you test one of those 3 patches which I sent to 
this email thread? If it change something for your kernel or 
userspace? I would like to know if I found another bug in qemu or 
same as you had...

-- 
Pali Rohár
pali.ro...@gmail.com


signature.asc
Description: This is a digitally signed message part.


Re: [PATCH 2/2] x86/tbl/trace: Do not trace on CPU that is offline

2015-02-07 Thread Sedat Dilek
On Sat, Feb 7, 2015 at 11:14 PM, Paul E. McKenney
 wrote:
> On Sat, Feb 07, 2015 at 04:52:05PM -0500, Steven Rostedt wrote:
>> On Sat, 7 Feb 2015 12:09:48 -0800
>> "Paul E. McKenney"  wrote:
>>
>> >The tag sequence has the meaning of:
>> >  git cherry-pick a1f84a3
>> >  git cherry-pick 1b9508f
>> >  git cherry-pick fd21073
>> >  git cherry-pick 
>> >
>> > Does that do what you need?
>>
>> Note, for this case it really doesn't apply, because one patch does not
>> depend on the other.
>>
>> The real bug is that a tracepoint can be called when RCU is not
>> watching (cpu is offline). That bug was introduced in 3.17 and is fixed
>> by patch 2 with the conditional trace event.
>>
>> When that bug was fixed, it showed that another bug exists. That is
>> that lockdep should not complain if the conditional prevents the bad
>> RCU from happening, and this bug was introduced in 3.18. This was fixed
>> by the first patch.
>>
>> They really are two entirely separate bugs, it just happens that the
>> test case Sedat had happened to trigger both of them. This is why I
>> really don't see why the two need to reference each other.
>>
>> I'm also going to modify patch 1 to not mention porting the other
>> commit (that patch 1 fixes) to 3.17 (from 3.18), as that other commit is
>> just a debugging tool and not something that satisfies being
>> backported, and the patch that fixes it shouldn't be backported to 3.17
>> either, only to 3.18.
>
> Thank you for the explanation!  I guess I needed to have kept a scorecard
> on this one.  ;-)
>

My misunderstanding and thanks again for the clarification.
As Steve pointed out, /me needs both patches to fix my broken testcase.
My wish was not to forget affected (previous) linux-stable releases
when dealing with the issue.

- Sedat -
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ASoC: sirf: atlas7: fix platform_no_drv_owner.cocci warnings

2015-02-07 Thread kbuild test robot
sound/soc/sirf/atlas7-iacc.c:625:3-8: No need to set .owner here. The core will 
do it.

 Remove .owner field if calls are used which set it automatically

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

CC: Rongjun Ying 
Signed-off-by: Fengguang Wu 
---

 atlas7-iacc.c |1 -
 1 file changed, 1 deletion(-)

--- a/sound/soc/sirf/atlas7-iacc.c
+++ b/sound/soc/sirf/atlas7-iacc.c
@@ -622,7 +622,6 @@ static const struct dev_pm_ops atlas7_ia
 static struct platform_driver atlas7_iacc_driver = {
.driver = {
.name = "sirf-atlas7-iacc",
-   .owner = THIS_MODULE,
.of_match_table = atlas7_iacc_of_match,
.pm = _iacc_pm_ops,
},
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/3] drivers: usb: storage: cypress_atacb.c: trivial checkpatch fixes

2015-02-07 Thread Bas Peters
Fixes errors thrown by checkpatch over a space issue and the
incorrect indentation of a switch statement.

Signed-off-by: Bas Peters 
---
 drivers/usb/storage/cypress_atacb.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/storage/cypress_atacb.c 
b/drivers/usb/storage/cypress_atacb.c
index 8514a2d..b3466d1 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -96,13 +96,13 @@ static void cypress_atacb_passthrough(struct scsi_cmnd 
*srb, struct us_data *us)
if (save_cmnd[1] >> 5) /* MULTIPLE_COUNT */
goto invalid_fld;
/* check protocol */
-   switch((save_cmnd[1] >> 1) & 0xf) {
-   case 3: /*no DATA */
-   case 4: /* PIO in */
-   case 5: /* PIO out */
-   break;
-   default:
-   goto invalid_fld;
+   switch ((save_cmnd[1] >> 1) & 0xf) {
+   case 3: /*no DATA */
+   case 4: /* PIO in */
+   case 5: /* PIO out */
+   break;
+   default:
+   goto invalid_fld;
}
 
/* first build the ATACB command */
@@ -132,8 +132,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd 
*srb, struct us_data *us)
|| save_cmnd[11])
goto invalid_fld;
}
-   }
-   else { /* ATA12 */
+   } else { /* ATA12 */
srb->cmnd[ 6] = save_cmnd[3]; /* features */
srb->cmnd[ 7] = save_cmnd[4]; /* sector count */
srb->cmnd[ 8] = save_cmnd[5]; /* lba low */
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] drivers: usb: storage: alauda.c: properly place braces after function declarations

2015-02-07 Thread Bas Peters
This patch places braces on a new line following function declarations.

Signed-off-by: Bas Peters 
---
 drivers/usb/storage/alauda.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 62c2d9d..4b55ab6 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -207,7 +207,8 @@ static struct alauda_card_info alauda_card_ids[] = {
{ 0,}
 };
 
-static struct alauda_card_info *alauda_card_find_id(unsigned char id) {
+static struct alauda_card_info *alauda_card_find_id(unsigned char id)
+{
int i;
 
for (i = 0; alauda_card_ids[i].id != 0; i++)
@@ -223,7 +224,8 @@ static struct alauda_card_info 
*alauda_card_find_id(unsigned char id) {
 static unsigned char parity[256];
 static unsigned char ecc2[256];
 
-static void nand_init_ecc(void) {
+static void nand_init_ecc(void)
+{
int i, j, a;
 
parity[0] = 0;
@@ -247,7 +249,8 @@ static void nand_init_ecc(void) {
 }
 
 /* compute 3-byte ecc on 256 bytes */
-static void nand_compute_ecc(unsigned char *data, unsigned char *ecc) {
+static void nand_compute_ecc(unsigned char *data, unsigned char *ecc)
+{
int i, j, a;
unsigned char par = 0, bit, bits[8] = {0};
 
@@ -270,11 +273,13 @@ static void nand_compute_ecc(unsigned char *data, 
unsigned char *ecc) {
ecc[2] = ecc2[par];
 }
 
-static int nand_compare_ecc(unsigned char *data, unsigned char *ecc) {
+static int nand_compare_ecc(unsigned char *data, unsigned char *ecc)
+{
return (data[0] == ecc[0] && data[1] == ecc[1] && data[2] == ecc[2]);
 }
 
-static void nand_store_ecc(unsigned char *data, unsigned char *ecc) {
+static void nand_store_ecc(unsigned char *data, unsigned char *ecc)
+{
memcpy(data, ecc, 3);
 }
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/3] drivers: usb: storage: fix some checkpatch errors

2015-02-07 Thread Bas Peters
This patchset adresses checkpatch errors in a few of the files in usb
storage. More to follow.

Bas Peters (3):
  drivers: usb: storage: alauda.c: properly place braces after function 
   declarations
  drivers: usb: storage: cypress_atacb.c: trivial checkpatch fixes
  drivers: usb: storage: datafab.c: clean up a variety of checkpatch
errors.

 drivers/usb/storage/alauda.c|  15 ++-
 drivers/usb/storage/cypress_atacb.c |  17 ++--
 drivers/usb/storage/datafab.c   | 183 ++--
 3 files changed, 111 insertions(+), 104 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] drivers: usb: storage: datafab.c: clean up a variety of checkpatch errors.

2015-02-07 Thread Bas Peters
This patch cleans up a variety of checkpatch errors:

Bunch of space issues.
C99 comments converted to /* */ format.
Some switch statement indentations.
"foo * bar" -> "foo *bar"

Signed-off-by: Bas Peters 
---
 drivers/usb/storage/datafab.c | 183 +-
 1 file changed, 93 insertions(+), 90 deletions(-)

diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index 7b17c21..78f867d 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -10,7 +10,7 @@
  *   Many thanks to Robert Baruch for the SanDisk SmartMedia reader driver
  *   which I used as a template for this driver.
  *
- *   Some bugfixes and scatter-gather code by Gregory P. Smith 
+ *   Some bugfixes and scatter-gather code by Gregory P. Smith
  *   (greg-...@electricrain.com)
  *
  *   Fix for media change by Joerg Schneider (j...@joergschneider.com)
@@ -35,8 +35,8 @@
 
 /*
  * This driver attempts to support USB CompactFlash reader/writer devices
- * based on Datafab USB-to-ATA chips.  It was specifically developed for the 
- * Datafab MDCFE-B USB CompactFlash reader but has since been found to work 
+ * based on Datafab USB-to-ATA chips.  It was specifically developed for the
+ * Datafab MDCFE-B USB CompactFlash reader but has since been found to work
  * with a variety of Datafab-based devices from a number of manufacturers.
  * I've received a report of this driver working with a Datafab-based
  * SmartMedia device though please be aware that I'm personally unable to
@@ -153,11 +153,12 @@ static int datafab_read_data(struct us_data *us,
unsigned int sg_offset = 0;
struct scatterlist *sg = NULL;
 
-   // we're working in LBA mode.  according to the ATA spec, 
-   // we can support up to 28-bit addressing.  I don't know if Datafab
-   // supports beyond 24-bit addressing.  It's kind of hard to test 
-   // since it requires > 8GB CF card.
-   //
+   /* we're working in LBA mode.  according to the ATA spec,
+* we can support up to 28-bit addressing.  I don't know if Datafab
+* supports beyond 24-bit addressing.  It's kind of hard to test
+* since it requires > 8GB CF card.
+*/
+
if (sectors > 0x0FFF)
return USB_STOR_TRANSPORT_ERROR;
 
@@ -169,9 +170,10 @@ static int datafab_read_data(struct us_data *us,
 
totallen = sectors * info->ssize;
 
-   // Since we don't read more than 64 KB at a time, we have to create
-   // a bounce buffer and move the data a piece at a time between the
-   // bounce buffer and the actual transfer buffer.
+   /* Since we don't read more than 64 KB at a time, we have to create
+* a bounce buffer and move the data a piece at a time between the
+* bounce buffer and the actual transfer buffer.
+*/
 
alloclen = min(totallen, 65536u);
buffer = kmalloc(alloclen, GFP_NOIO);
@@ -179,8 +181,9 @@ static int datafab_read_data(struct us_data *us,
return USB_STOR_TRANSPORT_ERROR;
 
do {
-   // loop, never allocate or transfer more than 64k at once
-   // (min(128k, 255*info->ssize) is the real limit)
+   /* loop, never allocate or transfer more than 64k at once
+* (min(128k, 255*info->ssize) is the real limit)
+*/
 
len = min(totallen, alloclen);
thistime = (len / info->ssize) & 0xff;
@@ -196,17 +199,17 @@ static int datafab_read_data(struct us_data *us,
command[6] = 0x20;
command[7] = 0x01;
 
-   // send the read command
+   /* send the read command */
result = datafab_bulk_write(us, command, 8);
if (result != USB_STOR_XFER_GOOD)
goto leave;
 
-   // read the result
+   /* read the result */
result = datafab_bulk_read(us, buffer, len);
if (result != USB_STOR_XFER_GOOD)
goto leave;
 
-   // Store the data in the transfer buffer
+   /* Store the data in the transfer buffer */
usb_stor_access_xfer_buf(buffer, len, us->srb,
 , _offset, TO_XFER_BUF);
 
@@ -237,11 +240,11 @@ static int datafab_write_data(struct us_data *us,
unsigned int sg_offset = 0;
struct scatterlist *sg = NULL;
 
-   // we're working in LBA mode.  according to the ATA spec, 
-   // we can support up to 28-bit addressing.  I don't know if Datafab
-   // supports beyond 24-bit addressing.  It's kind of hard to test 
-   // since it requires > 8GB CF card.
-   //
+   /* we're working in LBA mode.  according to the ATA spec,
+* we can support up to 28-bit addressing.  I don't know if Datafab
+* supports beyond 24-bit addressing.  It's kind of hard to test
+  

Re: [PATCH/RFC 0/4] Probe deferral for IOMMU DT integration

2015-02-07 Thread a...@arndb.de
Laura Abbott  hat am 6. Februar 2015 um 01:31
geschrieben:
>
> The requirement for this is based on a previous patch to add clock
> support to the ARM SMMU driver[2]. Once we have clock support, it's
> possible that the driver itself may need to be defered which breaks
> a bunch of assumptions about how SMMU probing is supposed to work.
 
Hi Laura,
 
I was hoping that we would not need this, and instead treat the iommu in
the same way as timers and SMP initialization, both
of which need to be run early at boot time but may rely on clock controllers
to be initialized first.
 
Is there a specific requirement that makes this impossible here, or is your
intention to solve the problem more nicely by allowing deferred probing
over forcing the input clocks of the iommu to be early?
 
  Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: pxa: pxa27x skip default device initialization with DT

2015-02-07 Thread Daniel Mack
On 02/07/2015 10:18 PM, Robert Jarzmik wrote:
> When booting via DT, the default PXA devices must not have been probed
> before, otherwise the augmented information from the device tree is
> ignored.
> 
> This is the twin commit of commit 82ce44d104dc ("ARM: pxa3xx: skip
> default device initialization when booting via DT").
> 
> Signed-off-by: Robert Jarzmik 

Looks good to me - thanks!

Acked-by: Daniel Mack 

> ---
>  arch/arm/mach-pxa/pxa27x.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
> index 0485248..b5abdeb 100644
> --- a/arch/arm/mach-pxa/pxa27x.c
> +++ b/arch/arm/mach-pxa/pxa27x.c
> @@ -307,8 +307,12 @@ static int __init pxa27x_init(void)
>   register_syscore_ops(_irq_syscore_ops);
>   register_syscore_ops(_mfp_syscore_ops);
>  
> - pxa_register_device(_device_gpio, _gpio_info);
> - ret = platform_add_devices(devices, ARRAY_SIZE(devices));
> + if (!of_have_populated_dt()) {
> + pxa_register_device(_device_gpio,
> + _gpio_info);
> + ret = platform_add_devices(devices,
> +ARRAY_SIZE(devices));
> + }
>   }
>  
>   return ret;
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] llist: Fix missing lockless_dereference()

2015-02-07 Thread Mathieu Desnoyers
- Original Message -
> From: "Greg KH" 
> To: "Mathieu Desnoyers" 
> Cc: "Huang Ying" , linux-kernel@vger.kernel.org, "Paul 
> McKenney" ,
> "David Howells" , "Pranith Kumar" 
> , sta...@vger.kernel.org
> Sent: Saturday, February 7, 2015 5:16:25 PM
> Subject: Re: [PATCH] llist: Fix missing lockless_dereference()
> 
> On Fri, Feb 06, 2015 at 09:08:21PM -0500, Mathieu Desnoyers wrote:
> > A lockless_dereference() appears to be missing in llist_del_first().
> > It should only matter for Alpha in practice.
> 
> Meta-comment, do we really care about Alpha anymore?  Is it still
> consered an "active" arch we support?  I haven't seen a single
> alpha-related stable patch in _years_ if at all, which implies to me
> that no one is even using it.
> 
> Not that stable patches for architectures are a valid reference for how
> much they are used, but it does give me a good indication of what arches
> have users that actually care about a modern (i.e. within the past 5
> years) kernel.

Good question. Adding the Alpha maintainers to the CC.

Thanks,

Mathieu

> 
> thanks,
> 
> greg k-h
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] llist: Fix missing lockless_dereference()

2015-02-07 Thread Greg KH
On Fri, Feb 06, 2015 at 09:08:21PM -0500, Mathieu Desnoyers wrote:
> A lockless_dereference() appears to be missing in llist_del_first().
> It should only matter for Alpha in practice.

Meta-comment, do we really care about Alpha anymore?  Is it still
consered an "active" arch we support?  I haven't seen a single
alpha-related stable patch in _years_ if at all, which implies to me
that no one is even using it.

Not that stable patches for architectures are a valid reference for how
much they are used, but it does give me a good indication of what arches
have users that actually care about a modern (i.e. within the past 5
years) kernel.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86/tbl/trace: Do not trace on CPU that is offline

2015-02-07 Thread Paul E. McKenney
On Sat, Feb 07, 2015 at 04:52:05PM -0500, Steven Rostedt wrote:
> On Sat, 7 Feb 2015 12:09:48 -0800
> "Paul E. McKenney"  wrote:
> 
> >The tag sequence has the meaning of:
> >  git cherry-pick a1f84a3
> >  git cherry-pick 1b9508f
> >  git cherry-pick fd21073
> >  git cherry-pick 
> > 
> > Does that do what you need?
> 
> Note, for this case it really doesn't apply, because one patch does not
> depend on the other.
> 
> The real bug is that a tracepoint can be called when RCU is not
> watching (cpu is offline). That bug was introduced in 3.17 and is fixed
> by patch 2 with the conditional trace event.
> 
> When that bug was fixed, it showed that another bug exists. That is
> that lockdep should not complain if the conditional prevents the bad
> RCU from happening, and this bug was introduced in 3.18. This was fixed
> by the first patch.
> 
> They really are two entirely separate bugs, it just happens that the
> test case Sedat had happened to trigger both of them. This is why I
> really don't see why the two need to reference each other.
> 
> I'm also going to modify patch 1 to not mention porting the other
> commit (that patch 1 fixes) to 3.17 (from 3.18), as that other commit is
> just a debugging tool and not something that satisfies being
> backported, and the patch that fixes it shouldn't be backported to 3.17
> either, only to 3.18.

Thank you for the explanation!  I guess I needed to have kept a scorecard
on this one.  ;-)

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] clk: hi6220: Clock driver support for Hisilicon hi6220 SoC

2015-02-07 Thread Tyler Baker
Hi Bintian,

On 7 February 2015 at 10:05, Brent Wang  wrote:
> Hello Tyler,
>
> Thank you very much for helping test this patchset!

Not a problem.

>
> 2015-02-07 2:10 GMT+08:00 Tyler Baker :
>> Hi Bintian,
>>
>> This patch applied to next-20150204 is producing build failures on
>> various ARM defconfigs[1]. I received the following error in all
>> cases:
>>
>> drivers/built-in.o: In function `hi6220_clk_register_divider':
>> :(.init.text+0x1a84c): undefined reference to `hi6220_register_clkdiv'
>> Makefile:925: recipe for target 'vmlinux' failed
>> make: *** [vmlinux] Error 1
> It's my fault, I just test on ARM64, The following patch can fix this error:
> =
> diff --git a/drivers/clk/hisilicon/Makefile b/drivers/clk/hisilicon/Makefile
> index bbf0539..48f0116 100644
> --- a/drivers/clk/hisilicon/Makefile
> +++ b/drivers/clk/hisilicon/Makefile
> @@ -2,9 +2,9 @@
>  # Hisilicon Clock specific Makefile
>  #
>
> -obj-y  += clk.o clkgate-separated.o
> +obj-y  += clk.o clkgate-separated.o clkdivider-hi6220.o
>
>  obj-$(CONFIG_ARCH_HI3xxx)  += clk-hi3620.o
>  obj-$(CONFIG_ARCH_HIP04)   += clk-hip04.o
>  obj-$(CONFIG_ARCH_HIX5HD2) += clk-hix5hd2.o
> -obj-$(CONFIG_COMMON_CLK_HI6220)+= clkdivider-hi6220.o clk-hi6220.o
> +obj-$(CONFIG_COMMON_CLK_HI6220)+= clk-hi6220.o
> ==
>
> I will fix this problem in next version.

Great, thank you. I quickly tested your change above, and it gets the
ARM defconfigs building again.

>
> Thanks,
>
> Bintian
>
>
>>
>> On 5 February 2015 at 01:24, Bintian Wang  wrote:
>>> Add clock drivers for hi6220 SoC, this driver controls the SoC
>>> registers to supply different clocks to different IPs in the SoC.
>>>
>>> We add one divider clock for hi6220 because the divider in hi6220
>>> also has a mask bit but it doesnot obey the rule defined by flag
>>> "CLK_DIVIDER_HIWORD_MASK", we can not get index of the mask bit by
>>> left shift fixed bits (e.g. 16 bits), so we add this divider clock
>>> to handle it.
>>>
>>> This patch also enables this clock driver for ARCH_HISI and document
>>> devicetree bindings.
>>>
>>> Signed-off-by: Bintian Wang 
>>> Reviewed-by: Haojian Zhuang 
>>> Reviewed-by: Zhangfei Gao 
>>> ---
>>>  .../devicetree/bindings/clock/hi6220-clock.txt |   30 +++
>>>  arch/arm64/Kconfig |1 +
>>>  drivers/clk/Kconfig|2 +
>>>  drivers/clk/Makefile   |4 +-
>>>  drivers/clk/hisilicon/Kconfig  |5 +
>>>  drivers/clk/hisilicon/Makefile |1 +
>>>  drivers/clk/hisilicon/clk-hi6220.c |  284 
>>> 
>>>  drivers/clk/hisilicon/clk.c|   29 ++
>>>  drivers/clk/hisilicon/clk.h|   17 ++
>>>  drivers/clk/hisilicon/clkdivider-hi6220.c  |  273 
>>> +++
>>>  include/dt-bindings/clock/hi6220-clock.h   |  172 
>>>  11 files changed, 815 insertions(+), 3 deletions(-)
>>>  create mode 100644 Documentation/devicetree/bindings/clock/hi6220-clock.txt
>>>  create mode 100644 drivers/clk/hisilicon/Kconfig
>>>  create mode 100644 drivers/clk/hisilicon/clk-hi6220.c
>>>  create mode 100644 drivers/clk/hisilicon/clkdivider-hi6220.c
>>>  create mode 100644 include/dt-bindings/clock/hi6220-clock.h
>>>
>>> diff --git a/Documentation/devicetree/bindings/clock/hi6220-clock.txt 
>>> b/Documentation/devicetree/bindings/clock/hi6220-clock.txt
>>> new file mode 100644
>>> index 000..a3ddda1
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/clock/hi6220-clock.txt
>>> @@ -0,0 +1,30 @@
>>> +* Hisilicon Hi6220 Clock Controller
>>> +
>>> +The hi6220 clock controller generates and supplies clock to various
>>> +controllers within the hi6220 SoC.
>>> +
>>> +Required Properties:
>>> +
>>> +- compatible: should be one of the following:
>>> +  - "hisilicon,hi6220-clock-ao" - controller for those clocks under SoC
>>> + power always on(AO) domain, it is the sub node of SoC power AO
>>> + controller in dts file.
>>> +  - "hisilicon,hi6220-clock-sys" - controller for those clocks under SoC
>>> + system control domain, it is the sub node of SoC system controller
>>> + in dts file.
>>> +  - "hisilicon,hi6220-clock-media" - controller for those clocks under
>>> + SoC media control domain, it is the sub node of SoC media controller
>>> + in dts file.
>>> +  - "hisilicon,hi6220-clock-power" - controller for those clocks under
>>> + SoC power control domain, it is the sub node of SoC power controller
>>> + in dts file.
>>> +
>>> +- reg: physical base address of the controller and length of memory mapped
>>> +  region.
>>> +
>>> +- #clock-cells: should be 1.
>>> +
>>> +Each clock is assigned an identifier and client nodes use this identifier
>>> +to specify the clock which they consume.
>>> +
>>> +All these identifier could be found in .
>>> diff 

[PATCH 2/7] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch fixes the following checkpatch errors:
1. trailing statement
1. assignment of variable in if condition
1. incorrectly placed brace after function definition

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/capi.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 3f66ca2..5d677e6 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m->hdr.cmd.cmd = c; \
m->hdr.cmd.subcmd = s;  \
m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else m = NULL;\
+   } else
+   m = NULL;   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
@@ -563,7 +564,8 @@ actcapi_data_b3_ind(act2000_card *card, struct sk_buff 
*skb) {
blocknr = msg->msg.data_b3_ind.blocknr;
skb_pull(skb, 19);
card->interface.rcvcallb_skb(card->myid, chan, skb);
-   if (!(skb = alloc_skb(11, GFP_ATOMIC))) {
+   skb = alloc_skb(11, GFP_ATOMIC);
+   if (!skb) {
printk(KERN_WARNING "actcapi: alloc_skb failed\n");
return 1;
}
@@ -990,7 +992,8 @@ actcapi_debug_dlpd(actcapi_dlpd *dlpd)
 }
 
 #ifdef DEBUG_DUMP_SKB
-static void dump_skb(struct sk_buff *skb) {
+static void dump_skb(struct sk_buff *skb)
+{
char tmp[80];
char *p = skb->data;
char *t = tmp;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/7] drivers: isdn: act2000: remove assignments of variables in if conditions

2015-02-07 Thread Bas Peters
This patch removes all assignments of if conditions, which is not in
accordance with the CodingStyle.
---
 drivers/isdn/act2000/module.c | 30 --
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index c3a1b06..352916a 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -289,7 +289,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (copy_from_user(tmp, arg,
   sizeof(tmp)))
return -EFAULT;
-   if ((ret = act2000_set_msn(card, tmp)))
+   ret = act2000_set_msn(card, tmp);
+   if (ret)
return ret;
if (card->flags & ACT2000_FLAGS_RUNNING)
return (actcapi_manufacturer_req_msn(card));
@@ -312,7 +313,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_DIAL:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
spin_lock_irqsave(>lock, flags);
if (chan->fsm_state != ACT2000_STATE_NULL) {
@@ -341,7 +343,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_ACCEPTD:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
if (chan->fsm_state == ACT2000_STATE_ICALL)
actcapi_select_b2_protocol_req(card, chan);
@@ -353,7 +356,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_HANGUP:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
switch (chan->fsm_state) {
case ACT2000_STATE_ICALL:
@@ -368,7 +372,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETEAZ:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
if (strlen(c->parm.num)) {
if (card->ptype == ISDN_PTYPE_EURO) {
@@ -388,7 +393,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_CLREAZ:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->eazmask = 0;
actcapi_listen_req(card);
@@ -396,7 +402,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETL2:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->l2prot = (c->arg >> 8);
return 0;
@@ -407,7 +414,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
printk(KERN_WARNING "L3 protocol unknown\n");
return -1;
}
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->l3prot = (c->arg >> 8);
return 0;
@@ -424,7 +432,8 @@ act2000_sendbuf(act2000_card *card, int channel, int ack, 
struct sk_buff *skb)
act2000_chan *chan;
actcapi_msg *msg;
 
-   if (!(chan = find_channel(card, channel)))
+   chan = find_channel(card, channel);
+   if (!chan)
return -1;
if (chan->fsm_state != ACT2000_STATE_ACTIVE)
return -1;
@@ -573,7 +582,8 @@ act2000_alloccard(int bus, int port, int irq, char *id)
 {
int i;
act2000_card *card;
-   if (!(card = kzalloc(sizeof(act2000_card), GFP_KERNEL))) {
+   card = kzalloc(sizeof(act2000_card), GFP_KERNEL);
+   if (!card) {
printk(KERN_WARNING
   "act2000: (%s) 

[PATCH 2/6] drivers: usb: core: devio.c: fix whitespace errors thrown by checkpatch.pl

2015-02-07 Thread Bas Peters
This patch fixes errors generated by checkpatch.pl relating to
whitespace issues.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/devio.c | 61 
 1 file changed, 31 insertions(+), 30 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index ea3c737..7c932d9 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -103,7 +103,7 @@ MODULE_PARM_DESC(usbfs_snoop, "true to log all usbfs 
traffic");
 #define snoop(dev, format, arg...) \
do {\
if (usbfs_snoop)\
-   dev_info(dev , format , ## arg);\
+   dev_info(dev, format, ## arg);  \
} while (0)
 
 enum snoop_when {
@@ -1320,7 +1320,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
struct usbdevfs_urb *uurb
is_in = (uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0;
 
u = 0;
-   switch(uurb->type) {
+   switch (uurb->type) {
case USBDEVFS_URB_TYPE_CONTROL:
if (!usb_endpoint_xfer_control(>desc))
return -EINVAL;
@@ -1944,38 +1944,39 @@ static int proc_ioctl(struct usb_dev_state *ps, struct 
usbdevfs_ioctl *ctl)
retval = -EHOSTUNREACH;
else if (!(intf = usb_ifnum_to_if(ps->dev, ctl->ifno)))
retval = -EINVAL;
-   else switch (ctl->ioctl_code) {
-
-   /* disconnect kernel driver from interface */
-   case USBDEVFS_DISCONNECT:
-   if (intf->dev.driver) {
-   driver = to_usb_driver(intf->dev.driver);
-   dev_dbg(>dev, "disconnect by usbfs\n");
-   usb_driver_release_interface(driver, intf);
-   } else
-   retval = -ENODATA;
-   break;
+   else
+   switch (ctl->ioctl_code) {
+
+   /* disconnect kernel driver from interface */
+   case USBDEVFS_DISCONNECT:
+   if (intf->dev.driver) {
+   driver = to_usb_driver(intf->dev.driver);
+   dev_dbg(>dev, "disconnect by usbfs\n");
+   usb_driver_release_interface(driver, intf);
+   } else
+   retval = -ENODATA;
+   break;
 
-   /* let kernel drivers try to (re)bind to the interface */
-   case USBDEVFS_CONNECT:
-   if (!intf->dev.driver)
-   retval = device_attach(>dev);
-   else
-   retval = -EBUSY;
-   break;
+   /* let kernel drivers try to (re)bind to the interface */
+   case USBDEVFS_CONNECT:
+   if (!intf->dev.driver)
+   retval = device_attach(>dev);
+   else
+   retval = -EBUSY;
+   break;
 
-   /* talk directly to the interface's driver */
-   default:
-   if (intf->dev.driver)
-   driver = to_usb_driver(intf->dev.driver);
-   if (driver == NULL || driver->unlocked_ioctl == NULL) {
-   retval = -ENOTTY;
-   } else {
-   retval = driver->unlocked_ioctl(intf, ctl->ioctl_code, 
buf);
-   if (retval == -ENOIOCTLCMD)
+   /* talk directly to the interface's driver */
+   default:
+   if (intf->dev.driver)
+   driver = to_usb_driver(intf->dev.driver);
+   if (driver == NULL || driver->unlocked_ioctl == NULL) {
retval = -ENOTTY;
+   } else {
+   retval = driver->unlocked_ioctl(intf, 
ctl->ioctl_code, buf);
+   if (retval == -ENOIOCTLCMD)
+   retval = -ENOTTY;
+   }
}
-   }
 
/* cleanup and return */
if (retval >= 0
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/6] drivers: usb: core: hub.c: remove NULL initialization of static variables.

2015-02-07 Thread Bas Peters
NULL initialization of static variables is unnecessary as GCC kindly does
this for us.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/hub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index aeb50bb..82983d9 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -49,7 +49,7 @@ static void hub_event(struct work_struct *work);
 DEFINE_MUTEX(usb_port_peer_mutex);
 
 /* cycle leds on hubs that aren't blinking for attention */
-static bool blinkenlights = 0;
+static bool blinkenlights;
 module_param (blinkenlights, bool, S_IRUGO);
 MODULE_PARM_DESC (blinkenlights, "true to cycle leds on hubs");
 
@@ -78,7 +78,7 @@ MODULE_PARM_DESC(initial_descriptor_timeout,
  * otherwise the new scheme is used.  If that fails and "use_both_schemes"
  * is set, then the driver will make another attempt, using the other scheme.
  */
-static bool old_scheme_first = 0;
+static bool old_scheme_first;
 module_param(old_scheme_first, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(old_scheme_first,
 "start with the old device initialization scheme");
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/6] drivers: usb: core: endpoint.c: fix trivial whitespace issue

2015-02-07 Thread Bas Peters
Changes space-based indentation to tab-based indentation.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/endpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index 39a2402..101983b 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -51,7 +51,7 @@ static ssize_t wMaxPacketSize_show(struct device *dev,
 {
struct ep_device *ep = to_ep_device(dev);
return sprintf(buf, "%04x\n",
-   usb_endpoint_maxp(ep->desc) & 0x07ff);
+   usb_endpoint_maxp(ep->desc) & 0x07ff);
 }
 static DEVICE_ATTR_RO(wMaxPacketSize);
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/6] drivers: usb: core: fix various checkpatch errors.

2015-02-07 Thread Bas Peters
This patchset adresses various checkpatch errors found when running the
checkpatch script on the directory.

Bas Peters (6):
  drivers: usb: core: devio.c: remove assignment of variables in if
conditions.
  drivers: usb: core: devio.c: fix whitespace errors thrown by
checkpatch.pl
  drivers: usb: core: hcd.c: remove assignment of variables in if
conditions.
  drivers: usb: core: hub.c: remove NULL initialization of static
variables.
  drivers: usb: core: hub.c: remove assignment of variables in if
conditions.
  drivers: usb: core: endpoint.c: fix trivial whitespace issue

 drivers/usb/core/devio.c| 76 -
 drivers/usb/core/endpoint.c |  2 +-
 drivers/usb/core/hcd.c  | 15 ++---
 drivers/usb/core/hub.c  | 11 ---
 4 files changed, 58 insertions(+), 46 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/6] drivers: usb: core: hub.c: remove assignment of variables in if conditions.

2015-02-07 Thread Bas Peters
As specified in the CodingStyle.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/hub.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 82983d9..9afe8b0 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -671,8 +671,8 @@ resubmit:
if (hub->quiescing)
return;
 
-   if ((status = usb_submit_urb (hub->urb, GFP_ATOMIC)) != 0
-   && status != -ENODEV && status != -EPERM)
+   status = usb_submit_urb (hub->urb, GFP_ATOMIC);
+   if (status != 0 && status != -ENODEV && status != -EPERM)
dev_err (hub->intfdev, "resubmit --> %d\n", status);
 }
 
@@ -795,7 +795,8 @@ int usb_hub_clear_tt_buffer(struct urb *urb)
 * since each TT has "at least two" buffers that can need it (and
 * there can be many TTs per hub).  even if they're uncommon.
 */
-   if ((clear = kmalloc (sizeof *clear, GFP_ATOMIC)) == NULL) {
+   clear = kmalloc (sizeof *clear, GFP_ATOMIC);
+   if (clear == NULL) {
dev_err (>dev, "can't save CLEAR_TT_BUFFER state\n");
/* FIXME recover somehow ... RESET_TT? */
return -ENOMEM;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/6] drivers: usb: core: devio.c: remove assignment of variables in if conditions.

2015-02-07 Thread Bas Peters
This patch removes assignment of variables in if conditions in
accordance witht the CodingStyle.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/devio.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 0b59731..ea3c737 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1081,7 +1081,8 @@ static int proc_bulk(struct usb_dev_state *ps, void 
__user *arg)
ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb));
if (ret)
return ret;
-   if (!(tbuf = kmalloc(len1, GFP_KERNEL))) {
+   tbuf = kmalloc(len1, GFP_KERNEL);
+   if (!tbuf) {
ret = -ENOMEM;
goto done;
}
@@ -1223,7 +1224,8 @@ static int proc_setintf(struct usb_dev_state *ps, void 
__user *arg)
 
if (copy_from_user(, arg, sizeof(setintf)))
return -EFAULT;
-   if ((ret = checkintf(ps, setintf.interface)))
+   ret = checkintf(ps, setintf.interface);
+   if (ret)
return ret;
 
destroy_async_on_interface(ps, setintf.interface);
@@ -1392,7 +1394,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
struct usbdevfs_urb *uurb
number_of_packets = uurb->number_of_packets;
isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) *
   number_of_packets;
-   if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
+   isopkt = kmalloc(isofrmlen, GFP_KERNEL);
+   if (!isopkt)
return -ENOMEM;
if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) {
ret = -EFAULT;
@@ -1901,7 +1904,8 @@ static int proc_releaseinterface(struct usb_dev_state 
*ps, void __user *arg)
 
if (get_user(ifnum, (unsigned int __user *)arg))
return -EFAULT;
-   if ((ret = releaseintf(ps, ifnum)) < 0)
+   ret = releaseintf(ps, ifnum);
+   if (ret < 0)
return ret;
destroy_async_on_interface (ps, ifnum);
return 0;
@@ -1916,7 +1920,8 @@ static int proc_ioctl(struct usb_dev_state *ps, struct 
usbdevfs_ioctl *ctl)
struct usb_driver   *driver = NULL;
 
/* alloc buffer */
-   if ((size = _IOC_SIZE(ctl->ioctl_code)) > 0) {
+   size = _IOC_SIZE(ctl->ioctl_code);
+   if (size > 0) {
buf = kmalloc(size, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/6] drivers: usb: core: hcd.c: remove assignment of variables in if conditions.

2015-02-07 Thread Bas Peters
This patch removes assignment of variables in if conditions,
as specified in CodingStyle.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/hcd.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 11cee55..37c40d1 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2683,15 +2683,18 @@ int usb_add_hcd(struct usb_hcd *hcd,
 * bottom up so that hcds can customize the root hubs before hub_wq
 * starts talking to them.  (Note, bus id is assigned early too.)
 */
-   if ((retval = hcd_buffer_create(hcd)) != 0) {
+   retval = hcd_buffer_create(hcd);
+   if (retval != 0) {
dev_dbg(hcd->self.controller, "pool alloc failed\n");
goto err_create_buf;
}
 
-   if ((retval = usb_register_bus(>self)) < 0)
+   retval = usb_register_bus(>self);
+   if (retval < 0)
goto err_register_bus;
 
-   if ((rhdev = usb_alloc_dev(NULL, >self, 0)) == NULL) {
+   rhdev = usb_alloc_dev(NULL, >self, 0);
+   if (rhdev == NULL) {
dev_err(hcd->self.controller, "unable to allocate root hub\n");
retval = -ENOMEM;
goto err_allocate_root_hub;
@@ -2733,7 +2736,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
/* "reset" is misnamed; its role is now one-time init. the controller
 * should already have been reset (and boot firmware kicked off etc).
 */
-   if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0) {
+   retval = hcd->driver->reset(hcd);
+   if (hcd->driver->reset && retval < 0) {
dev_err(hcd->self.controller, "can't setup: %d\n", retval);
goto err_hcd_driver_setup;
}
@@ -2765,7 +2769,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
}
 
/* starting here, usbcore will pay attention to this root hub */
-   if ((retval = register_root_hub(hcd)) != 0)
+   retval = register_root_hub(hcd);
+   if (retval != 0)
goto err_register_root_hub;
 
retval = sysfs_create_group(>dev.kobj, _bus_attr_group);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 6/7] drivers: isdn: act2000: fix wrongly positioned brace.

2015-02-07 Thread Bas Peters
Trivial, but why not? :)

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/module.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 889ffcb..9ba98ce 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -19,8 +19,7 @@
 #include 
 #include 
 
-static unsigned short act2000_isa_ports[] =
-{
+static unsigned short act2000_isa_ports[] = {
0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380,
0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60,
 };
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 7/7] drivers: isdn: act2000: capi.c: add macro \ and fix brace

2015-02-07 Thread Bas Peters
This patch adds the \ that was accidentally deleted in patch 2. It also adds a 
brace after the else statement, which is required due to the fact that the if 
statement has braces.

---
 drivers/isdn/act2000/capi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 5d677e6..0043b3c 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,8 +113,9 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m->hdr.cmd.cmd = c; \
m->hdr.cmd.subcmd = s;  \
m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else
+   } else {\
m = NULL;   \
+   }   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/3] drivers: isdn: isdnloop: isdnloop.c: remove assignment of variables in if conditions, in accordance with the CodingStyle.

2015-02-07 Thread Bas Peters
Please discard all these e-mails, something went wrong and I sent the
wrong directory of patches.

2015-02-07 22:54 GMT+01:00 Bas Peters :
> Signed-off-by: Bas Peters 
> ---
>  drivers/isdn/isdnloop/isdnloop.c | 18 ++
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/isdn/isdnloop/isdnloop.c 
> b/drivers/isdn/isdnloop/isdnloop.c
> index 5a4da94..af96317 100644
> --- a/drivers/isdn/isdnloop/isdnloop.c
> +++ b/drivers/isdn/isdnloop/isdnloop.c
> @@ -59,7 +59,8 @@ isdnloop_bchan_send(isdnloop_card *card, int ch)
> isdn_ctrl cmd;
>
> while (card->sndcount[ch]) {
> -   if ((skb = skb_dequeue(>bqueue[ch]))) {
> +   skb = skb_dequeue(>bqueue[ch]);
> +   if (skb) {
> len = skb->len;
> card->sndcount[ch] -= len;
> ack = *(skb->head); /* used as scratch area */
> @@ -317,7 +318,8 @@ isdnloop_polldchan(unsigned long data)
> u_char *p;
> isdn_ctrl cmd;
>
> -   if ((skb = skb_dequeue(>dqueue)))
> +   skb = skb_dequeue(>dqueue);
> +   if (skb)
> avail = skb->len;
> else
> avail = 0;
> @@ -471,8 +473,8 @@ isdnloop_fake(isdnloop_card *card, char *s, int ch)
>  {
> struct sk_buff *skb;
> int len = strlen(s) + ((ch >= 0) ? 3 : 0);
> -
> -   if (!(skb = dev_alloc_skb(len))) {
> +   skb = dev_alloc_skb(len);
> +   if (!skb) {
> printk(KERN_WARNING "isdnloop: Out of memory in 
> isdnloop_fake\n");
> return 1;
> }
> @@ -1439,8 +1441,8 @@ isdnloop_initcard(char *id)
>  {
> isdnloop_card *card;
> int i;
> -
> -   if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) {
> +   card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL);
> +   if (!card) {
> printk(KERN_WARNING
>"isdnloop: (%s) Could not allocate card-struct.\n", 
> id);
> return (isdnloop_card *) 0;
> @@ -1489,8 +1491,8 @@ static int
>  isdnloop_addcard(char *id1)
>  {
> isdnloop_card *card;
> -
> -   if (!(card = isdnloop_initcard(id1))) {
> +   card = isdnloop_initcard(id1);
> +   if (!card) {
> return -EIO;
> }
> printk(KERN_INFO
> --
> 2.1.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] ext4: fix indirect punch hole corruption

2015-02-07 Thread Omar Sandoval
Commit 4f579ae7de56 (ext4: fix punch hole on files with indirect
mapping) rewrote FALLOC_FL_PUNCH_HOLE for ext4 files with indirect
mapping. However, the case where the punch happens within one level of
indirection is incorrect. It assumes that the partial branches returned
from ext4_find_shared will have the same depth, but this is not
necessarily the case even when the offsets have the same depth. For
example, if the last block occurs at the beginning of an indirect group
(i.e., it has an offset of 0 at the end of the offsets array), then
ext4_find_shared will return a shallower chain. So, let's handle the
mismatch and clean up that case.

This should reflect the original intent of the code. However, I'm still
seeing failures of generic/270 due to an inconsistent filesystem after
many runs, so there could be another bug here, or it could be unrelated.
I'll keep working on tracking that down.

Signed-off-by: Omar Sandoval 
---
Once again, this applies to v3.19-rc7. Chris, could you take this one
for a spin when you get the chance? Hopefully you'll be able to confirm
whether the corruption is still here or unrelated.

Changes from v1:
Handle partial == chain || partial2 == chain2 cases.

 fs/ext4/indirect.c | 57 +-
 1 file changed, 31 insertions(+), 26 deletions(-)

diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c
index 36b3696..3ff325f 100644
--- a/fs/ext4/indirect.c
+++ b/fs/ext4/indirect.c
@@ -1434,49 +1434,54 @@ end_range:
 * in punch_hole so we need to point to the next element
 */
partial2->p++;
-   while ((partial > chain) || (partial2 > chain2)) {
-   /* We're at the same block, so we're almost finished */
-   if ((partial->bh && partial2->bh) &&
-   (partial->bh->b_blocknr == partial2->bh->b_blocknr)) {
-   if ((partial > chain) && (partial2 > chain2)) {
-   ext4_free_branches(handle, inode, partial->bh,
-  partial->p + 1,
-  partial2->p,
-  (chain+n-1) - partial);
-   BUFFER_TRACE(partial->bh, "call brelse");
-   brelse(partial->bh);
-   BUFFER_TRACE(partial2->bh, "call brelse");
-   brelse(partial2->bh);
-   }
+   while (partial > chain || partial2 > chain2) {
+   int depth = (chain+n-1) - partial;
+   int depth2 = (chain2+n2-1) - partial2;
+
+   if (partial > chain && partial2 > chain2 &&
+   partial->bh->b_blocknr == partial2->bh->b_blocknr) {
+   /*
+* We've converged on the same block. Clear the range,
+* then we're done.
+*/
+   ext4_free_branches(handle, inode, partial->bh,
+  partial->p + 1,
+  partial2->p,
+  (chain+n-1) - partial);
+   BUFFER_TRACE(partial->bh, "call brelse");
+   brelse(partial->bh);
+   BUFFER_TRACE(partial2->bh, "call brelse");
+   brelse(partial2->bh);
return 0;
}
+
/*
-* Clear the ends of indirect blocks on the shared branch
-* at the start of the range
+* The start and end partial branches may not be at the same
+* level even though the punch happened within one level. So, we
+* give them a chance to arrive at the same level, then walk
+* them in step with each other until we converge on the same
+* block.
 */
-   if (partial > chain) {
+   if (partial > chain && depth <= depth2) {
ext4_free_branches(handle, inode, partial->bh,
-  partial->p + 1,
-  (__le32 *)partial->bh->b_data+addr_per_block,
-  (chain+n-1) - partial);
+  partial->p + 1,
+  (__le32 
*)partial->bh->b_data+addr_per_block,
+  (chain+n-1) - partial);
BUFFER_TRACE(partial->bh, "call brelse");
brelse(partial->bh);
partial--;
}
-   /*
-* Clear the ends of indirect blocks on the shared branch
-* at the end of the range
-*/
-   if (partial2 > chain2) {
+   if (partial2 > chain2 && depth2 <= 

[PATCH 0/2] drivers: isdn: icn: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up all checkpatch errors in the icn directory.

Bas Peters (2):
  drivers: isdn: icn: icn.c: clean up all checkpatch errors
  drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

 drivers/isdn/icn/icn.c | 52 ++
 drivers/isdn/icn/icn.h |  5 ++---
 2 files changed, 33 insertions(+), 24 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2 0/7] drivers: isdn: act2000: fix checkpatch errors.

2015-02-07 Thread Bas Peters
Please discard this

2015-02-07 22:53 GMT+01:00 Bas Peters :
> This patchset adresses many checkpatch errors found in the act2000 driver.
>
> Bas Peters (7):
>   drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
>   drivers: isdn: act2000: capi.c: fix checkpatch errors
>   drivers: isdn: act2000: remove assignments of variables in if
> conditions
>   drivers: isdn: act2000: module.c: remove NULL-initialization of static
> variable.
>   drivers: isdn: act2000: module.c: remove parenthesres around return
>  values.
>   drivers: isdn: act2000: fix wrongly positioned brace.
>   drivers: isdn: act2000: capi.c: add macro \ and fix brace
>
>  drivers/isdn/act2000/act2000_isa.c | 11 +
>  drivers/isdn/act2000/capi.c| 10 +---
>  drivers/isdn/act2000/module.c  | 47 
> +++---
>  3 files changed, 42 insertions(+), 26 deletions(-)
>
> --
> 2.1.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/7] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors

2015-02-07 Thread Bas Peters
Please discard this

2015-02-07 22:53 GMT+01:00 Bas Peters :
> This patch adresses various checkpatch errors:
> 3 assignments in if conditions
> 1 return value enclosed in parenthesis
>
> Signed-off-by: Bas Peters 
> ---
>  drivers/isdn/act2000/act2000_isa.c | 11 +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/isdn/act2000/act2000_isa.c 
> b/drivers/isdn/act2000/act2000_isa.c
> index b5fad29..048507e 100644
> --- a/drivers/isdn/act2000/act2000_isa.c
> +++ b/drivers/isdn/act2000/act2000_isa.c
> @@ -31,7 +31,8 @@ act2000_isa_reset(unsigned short portbase)
> int serial = 0;
>
> found = 0;
> -   if ((reg = inb(portbase + ISA_COR)) != 0xff) {
> +   reg = inb(portbase + ISA_COR);
> +   if (reg != 0xff) {
> outb(reg | ISA_COR_RESET, portbase + ISA_COR);
> mdelay(10);
> outb(reg, portbase + ISA_COR);
> @@ -303,7 +304,8 @@ act2000_isa_send(act2000_card *card)
> while (1) {
> spin_lock_irqsave(>lock, flags);
> if (!(card->sbuf)) {
> -   if ((card->sbuf = skb_dequeue(>sndq))) {
> +   card->sbuf = skb_dequeue(>sndq);
> +   if (card->sbuf) {
> card->ack_msg = card->sbuf->data;
> msg = (actcapi_msg *)card->sbuf->data;
> if ((msg->hdr.cmd.cmd == 0x86) &&
> @@ -378,7 +380,8 @@ act2000_isa_getid(act2000_card *card)
> printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n");
> return -EPROTO;
> }
> -   if ((p = strchr(fid.revision, '\n')))
> +   p = strchr(fid.revision, '\n');
> +   if (p)
> *p = '\0';
> printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision);
> if (card->flags & ACT2000_FLAGS_IVALID) {
> @@ -439,5 +442,5 @@ act2000_isa_download(act2000_card *card, act2000_ddef 
> __user *cb)
> }
> kfree(buf);
> msleep_interruptible(500);
> -   return (act2000_isa_getid(card));
> +   return act2000_isa_getid(card);
>  }
> --
> 2.1.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

2015-02-07 Thread Bas Peters
Signed-off-by: Bas Peters 
---
 drivers/isdn/icn/icn.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/icn/icn.h b/drivers/isdn/icn/icn.h
index b713466..05daed2 100644
--- a/drivers/isdn/icn/icn.h
+++ b/drivers/isdn/icn/icn.h
@@ -54,7 +54,7 @@ typedef struct icn_cdef {
 
 /* some useful macros for debugging */
 #ifdef ICN_DEBUG_PORT
-#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p);}
+#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p); }
 #else
 #define OUTB_P outb
 #endif
@@ -186,8 +186,7 @@ typedef icn_dev *icn_devptr;
 #ifdef __KERNEL__
 
 static icn_card *cards = (icn_card *) 0;
-static u_char chan2bank[] =
-{0, 4, 8, 12};  /* for icn_map_channel() */
+static u_char chan2bank[] = {0, 4, 8, 12}; /* for icn_map_channel() */
 
 static icn_dev dev;
 
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/7] drivers: isdn: act2000: module.c: remove parenthesres around return values.

2015-02-07 Thread Bas Peters
return is not a function, therefore parentheses are not needed.
---
 drivers/isdn/act2000/module.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 9359b36..889ffcb 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -111,7 +111,7 @@ act2000_find_eaz(act2000_card *card, char eaz)
 
while (p) {
if (p->eaz == eaz)
-   return (p->msn);
+   return p->msn;
p = p->next;
}
return ("\0");
@@ -293,7 +293,7 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (ret)
return ret;
if (card->flags & ACT2000_FLAGS_RUNNING)
-   return (actcapi_manufacturer_req_msn(card));
+   return actcapi_manufacturer_req_msn(card);
return 0;
case ACT2000_IOCTL_ADDCARD:
if (copy_from_user(, arg,
@@ -520,7 +520,7 @@ if_command(isdn_ctrl *c)
act2000_card *card = act2000_findcard(c->driver);
 
if (card)
-   return (act2000_command(card, c));
+   return act2000_command(card, c);
printk(KERN_ERR
   "act2000: if_command %d called with invalid driverId %d!\n",
   c->command, c->driver);
@@ -535,7 +535,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (len);
+   return len;
}
printk(KERN_ERR
   "act2000: if_writecmd called with invalid driverId!\n");
@@ -550,7 +550,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_readstatus(buf, len, card));
+   return act2000_readstatus(buf, len, card);
}
printk(KERN_ERR
   "act2000: if_readstatus called with invalid driverId!\n");
@@ -565,7 +565,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff 
*skb)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_sendbuf(card, channel, ack, skb));
+   return act2000_sendbuf(card, channel, ack, skb);
}
printk(KERN_ERR
   "act2000: if_sendbuf called with invalid driverId!\n");
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/3] Fix checkpatch errors in drivers/isdn/isdnloop

2015-02-07 Thread Bas Peters
This patchset adresses various checkpatch errors in the abovementioned driver.

Bas Peters (3):
  drivers: isdn: isdnloop: isdnloop.c: remove assignment of variables in
if conditions, in accordance with the CodingStyle.
  drivers: isdn: isdnloop: isdnloop.c: Fix brace positions according to 
   CodingStyle specifications.
  drivers: isdn: isdnloop: isdnloop.c: Remove parenthesis around return 
   values, as specified in CodingStyle.

 drivers/isdn/isdnloop/isdnloop.c | 64 +++-
 1 file changed, 30 insertions(+), 34 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] drivers: isdn: isdnloop: isdnloop.c: remove assignment of variables in if conditions, in accordance with the CodingStyle.

2015-02-07 Thread Bas Peters
Signed-off-by: Bas Peters 
---
 drivers/isdn/isdnloop/isdnloop.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index 5a4da94..af96317 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -59,7 +59,8 @@ isdnloop_bchan_send(isdnloop_card *card, int ch)
isdn_ctrl cmd;
 
while (card->sndcount[ch]) {
-   if ((skb = skb_dequeue(>bqueue[ch]))) {
+   skb = skb_dequeue(>bqueue[ch]);
+   if (skb) {
len = skb->len;
card->sndcount[ch] -= len;
ack = *(skb->head); /* used as scratch area */
@@ -317,7 +318,8 @@ isdnloop_polldchan(unsigned long data)
u_char *p;
isdn_ctrl cmd;
 
-   if ((skb = skb_dequeue(>dqueue)))
+   skb = skb_dequeue(>dqueue);
+   if (skb)
avail = skb->len;
else
avail = 0;
@@ -471,8 +473,8 @@ isdnloop_fake(isdnloop_card *card, char *s, int ch)
 {
struct sk_buff *skb;
int len = strlen(s) + ((ch >= 0) ? 3 : 0);
-
-   if (!(skb = dev_alloc_skb(len))) {
+   skb = dev_alloc_skb(len);
+   if (!skb) {
printk(KERN_WARNING "isdnloop: Out of memory in 
isdnloop_fake\n");
return 1;
}
@@ -1439,8 +1441,8 @@ isdnloop_initcard(char *id)
 {
isdnloop_card *card;
int i;
-
-   if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) {
+   card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL);
+   if (!card) {
printk(KERN_WARNING
   "isdnloop: (%s) Could not allocate card-struct.\n", id);
return (isdnloop_card *) 0;
@@ -1489,8 +1491,8 @@ static int
 isdnloop_addcard(char *id1)
 {
isdnloop_card *card;
-
-   if (!(card = isdnloop_initcard(id1))) {
+   card = isdnloop_initcard(id1);
+   if (!card) {
return -EIO;
}
printk(KERN_INFO
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up various trivial checkpatch errors such as variable
declarations in if statements, return values in parenthesis and a
wrongly placed brace.

Signed-off-by: Bas Peters 
---
 drivers/isdn/icn/icn.c | 52 ++
 1 file changed, 31 insertions(+), 21 deletions(-)

diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 6a7447c..f499d5a 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -62,7 +62,8 @@ icn_free_queue(icn_card *card, int channel)
skb_queue_purge(queue);
card->xlen[channel] = 0;
card->sndcount[channel] = 0;
-   if ((skb = card->xskb[channel])) {
+   skb = card->xskb[channel];
+   if (skb) {
card->xskb[channel] = NULL;
dev_kfree_skb(skb);
}
@@ -272,8 +273,10 @@ icn_pollbchan_receive(int channel, icn_card *card)
rbnext;
icn_maprelease_channel(card, mch & 2);
if (!eflag) {
-   if ((cnt = card->rcvidx[channel])) {
-   if (!(skb = dev_alloc_skb(cnt))) {
+   cnt = card->rcvidx[channel];
+   if (cnt) {
+   skb = dev_alloc_skb(cnt);
+   if (!skb) {
printk(KERN_WARNING "icn: 
receive out of memory\n");
break;
}
@@ -409,8 +412,7 @@ typedef struct icn_stat {
int action;
 } icn_stat;
 /* *INDENT-OFF* */
-static icn_stat icn_stat_table[] =
-{
+static icn_stat icn_stat_table[] = {
{"BCON_",  ISDN_STAT_BCONN, 1}, /* B-Channel connected*/
{"BDIS_",  ISDN_STAT_BHUP,  2}, /* B-Channel disconnected */
/*
@@ -807,7 +809,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
 #ifdef BOOT_DEBUG
printk(KERN_DEBUG "icn_loadboot called, buffaddr=%08lx\n", (ulong) 
buffer);
 #endif
-   if (!(codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL))) {
+   codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL);
+   if (!codebuf) {
printk(KERN_WARNING "icn: Could not allocate code buffer\n");
ret = -ENOMEM;
goto out;
@@ -878,7 +881,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
}
SLEEP(1);
OUTB_P(0xff, ICN_RUN);  /* Start Boot-Code */
-   if ((ret = icn_check_loader(card->doubleS0 ? 2 : 1))) {
+   ret = icn_check_loader(card->doubleS0 ? 2 : 1);
+   if (ret) {
goto out_kfree;
}
if (!card->doubleS0) {
@@ -1246,10 +1250,11 @@ icn_command(isdn_ctrl *c, icn_card *card)
dev.firstload = 0;
}
icn_stopcard(card);
-   return (icn_loadboot(arg, card));
+   return icn_loadboot(arg, card);
case ICN_IOCTL_LOADPROTO:
icn_stopcard(card);
-   if ((i = (icn_loadproto(arg, card
+   i = icn_loadproto(arg, card);
+   if (i)
return i;
if (card->doubleS0)
i = icn_loadproto(arg + ICN_CODE_STAGE2, 
card->other);
@@ -1262,7 +1267,7 @@ icn_command(isdn_ctrl *c, icn_card *card)
   arg,
   sizeof(cdef)))
return -EFAULT;
-   return (icn_addcard(cdef.port, cdef.id1, cdef.id2));
+   return icn_addcard(cdef.port, cdef.id1, cdef.id2);
break;
case ICN_IOCTL_LEASEDCFG:
if (a) {
@@ -1458,7 +1463,7 @@ if_command(isdn_ctrl *c)
icn_card *card = icn_findcard(c->driver);
 
if (card)
-   return (icn_command(c, card));
+   return icn_command(c, card);
printk(KERN_ERR
   "icn: if_command %d called with invalid driverId %d!\n",
   c->command, c->driver);
@@ -1473,7 +1478,7 @@ if_writecmd(const u_char __user *buf, int len, int id, 
int channel)
if (card) {
if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
-   return (icn_writecmd(buf, len, 1, card));
+   return icn_writecmd(buf, len, 1, card);
}
printk(KERN_ERR
   "icn: if_writecmd called with invalid driverId!\n");
@@ -1488,7 +1493,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
-   return (icn_readstatus(buf, len, card));
+  

[PATCH 1/7] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch adresses various checkpatch errors:
3 assignments in if conditions
1 return value enclosed in parenthesis

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/act2000_isa.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/isdn/act2000/act2000_isa.c 
b/drivers/isdn/act2000/act2000_isa.c
index b5fad29..048507e 100644
--- a/drivers/isdn/act2000/act2000_isa.c
+++ b/drivers/isdn/act2000/act2000_isa.c
@@ -31,7 +31,8 @@ act2000_isa_reset(unsigned short portbase)
int serial = 0;
 
found = 0;
-   if ((reg = inb(portbase + ISA_COR)) != 0xff) {
+   reg = inb(portbase + ISA_COR);
+   if (reg != 0xff) {
outb(reg | ISA_COR_RESET, portbase + ISA_COR);
mdelay(10);
outb(reg, portbase + ISA_COR);
@@ -303,7 +304,8 @@ act2000_isa_send(act2000_card *card)
while (1) {
spin_lock_irqsave(>lock, flags);
if (!(card->sbuf)) {
-   if ((card->sbuf = skb_dequeue(>sndq))) {
+   card->sbuf = skb_dequeue(>sndq);
+   if (card->sbuf) {
card->ack_msg = card->sbuf->data;
msg = (actcapi_msg *)card->sbuf->data;
if ((msg->hdr.cmd.cmd == 0x86) &&
@@ -378,7 +380,8 @@ act2000_isa_getid(act2000_card *card)
printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n");
return -EPROTO;
}
-   if ((p = strchr(fid.revision, '\n')))
+   p = strchr(fid.revision, '\n');
+   if (p)
*p = '\0';
printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision);
if (card->flags & ACT2000_FLAGS_IVALID) {
@@ -439,5 +442,5 @@ act2000_isa_download(act2000_card *card, act2000_ddef 
__user *cb)
}
kfree(buf);
msleep_interruptible(500);
-   return (act2000_isa_getid(card));
+   return act2000_isa_getid(card);
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 0/7] drivers: isdn: act2000: fix checkpatch errors.

2015-02-07 Thread Bas Peters
This patchset adresses many checkpatch errors found in the act2000 driver. 

Bas Peters (7):
  drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
  drivers: isdn: act2000: capi.c: fix checkpatch errors
  drivers: isdn: act2000: remove assignments of variables in if
conditions
  drivers: isdn: act2000: module.c: remove NULL-initialization of static
variable.
  drivers: isdn: act2000: module.c: remove parenthesres around return   
 values.
  drivers: isdn: act2000: fix wrongly positioned brace.
  drivers: isdn: act2000: capi.c: add macro \ and fix brace

 drivers/isdn/act2000/act2000_isa.c | 11 +
 drivers/isdn/act2000/capi.c| 10 +---
 drivers/isdn/act2000/module.c  | 47 +++---
 3 files changed, 42 insertions(+), 26 deletions(-)

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/7] drivers: isdn: act2000: module.c: remove NULL-initialization of static variable.

2015-02-07 Thread Bas Peters
GCC takes care of this for us, thus it is not needed and theoretically
only hoggs memory, allbeit only a bit.
---
 drivers/isdn/act2000/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 352916a..9359b36 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -28,7 +28,7 @@ static unsigned short act2000_isa_ports[] =
 static act2000_card *cards = (act2000_card *) NULL;
 
 /* Parameters to be set by insmod */
-static int   act_bus  =  0;
+static int   act_bus;
 static int   act_port = -1;  /* -1 = Autoprobe  */
 static int   act_irq  = -1;
 static char *act_id   = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86/tbl/trace: Do not trace on CPU that is offline

2015-02-07 Thread Steven Rostedt
On Sat, 7 Feb 2015 12:09:48 -0800
"Paul E. McKenney"  wrote:

>The tag sequence has the meaning of:
>  git cherry-pick a1f84a3
>  git cherry-pick 1b9508f
>  git cherry-pick fd21073
>  git cherry-pick 
> 
> Does that do what you need?

Note, for this case it really doesn't apply, because one patch does not
depend on the other.

The real bug is that a tracepoint can be called when RCU is not
watching (cpu is offline). That bug was introduced in 3.17 and is fixed
by patch 2 with the conditional trace event.

When that bug was fixed, it showed that another bug exists. That is
that lockdep should not complain if the conditional prevents the bad
RCU from happening, and this bug was introduced in 3.18. This was fixed
by the first patch.

They really are two entirely separate bugs, it just happens that the
test case Sedat had happened to trigger both of them. This is why I
really don't see why the two need to reference each other.

I'm also going to modify patch 1 to not mention porting the other
commit (that patch 1 fixes) to 3.17 (from 3.18), as that other commit is
just a debugging tool and not something that satisfies being
backported, and the patch that fixes it shouldn't be backported to 3.17
either, only to 3.18.

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] HID: sony: Enable Gasia third-party PS3 controllers

2015-02-07 Thread Lauri Kasanen
Hi,

On Sat, 7 Feb 2015 17:31:33 +0100
Antonio Ospite  wrote:
> > > +#include 
> > 
> > Please don't.
> > HID should be transport agnostic, so please refrain from directly call usb.
> >
> 
> I agree with Benjamin here.
> 
> > > +
> > > +   ret = usb_interrupt_msg(dev, usb_sndintpipe(dev, 0x02),
> > > +   buf2, sizeof(buf2),
> > > +   , USB_CTRL_SET_TIMEOUT);
> > 
> > Can't you simply use a hid_hw_output_report request instead of hard
> > coding the device specific endpoint?
> > And I'd also prefer it to be guarded against your specific controller.
> > 
> 
> usb_interrupt_msg() is called in usbhid_output_report() indeed, so it
> should be possible to use the generic HID interface.

Regarding the USB. This is a comment from Andrew's patch:

// doesn't work. gets sent as a SET_REPORT Request intstead of a
// URB_INTERRUPT out. I guess usbhid->urbout is null
//if ( hdev->hid_output_raw_report(hdev, buf2, sizeof(buf2),

I took his word for it, and did not attempt it. Do you think it would
work with the current kernel? If so, I can test later. Had quite an
enjoyable evening playing some FF7 once I had the controller working ;)

Antonio, others, can you test with official Sony controllers that the
current patch did not break them? I only have the Gasia.

> > > +   if (ret < 0)
> > > +   hid_err(hdev, "can't set operational mode on the 
> > > interrupt EP\n");
> 
> And adjust this message accordingly. Call it "step 3" perhaps?

Sure, will edit the error messages.

- Lauri
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: pxa: pxa27x skip default device initialization with DT

2015-02-07 Thread Robert Jarzmik
When booting via DT, the default PXA devices must not have been probed
before, otherwise the augmented information from the device tree is
ignored.

This is the twin commit of commit 82ce44d104dc ("ARM: pxa3xx: skip
default device initialization when booting via DT").

Signed-off-by: Robert Jarzmik 
---
 arch/arm/mach-pxa/pxa27x.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 0485248..b5abdeb 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -307,8 +307,12 @@ static int __init pxa27x_init(void)
register_syscore_ops(_irq_syscore_ops);
register_syscore_ops(_mfp_syscore_ops);
 
-   pxa_register_device(_device_gpio, _gpio_info);
-   ret = platform_add_devices(devices, ARRAY_SIZE(devices));
+   if (!of_have_populated_dt()) {
+   pxa_register_device(_device_gpio,
+   _gpio_info);
+   ret = platform_add_devices(devices,
+  ARRAY_SIZE(devices));
+   }
}
 
return ret;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Joe Perches
On Sat, 2015-02-07 at 21:55 +0100, Bas Peters wrote:
> I thought it might have been
> useful and a good way to learn

Maybe pick a device you have (or maybe buy
something in the staging directory like a realtek
wireless device) and play with adding support for
something in it.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] usb/core: Remove unneeded #ifdef and associated dead code

2015-02-07 Thread Andreas Ruprecht
In commit ceb6c9c862c8 ("USB / PM: Drop CONFIG_PM_RUNTIME from the
USB core"), all occurrences of CONFIG_PM_RUNTIME in the USB core
code were replaced by CONFIG_PM. This created the following structure
of #ifdef blocks in drivers/usb/core/hub.c:

 [...]
 #ifdef CONFIG_PM
 #ifdef CONFIG_PM
 /* always on / undead */
 #else
 /* dead */
 #endif
 [...]

This patch removes the function in the dead #ifdef block and the
unnecessary inner #ifdef. This inconsistency was found using the
undertaker-checkpatch tool.

Signed-off-by: Andreas Ruprecht 
---
 drivers/usb/core/hub.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 3e9c4d4..c362bbc 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -3452,8 +3452,6 @@ int usb_port_resume(struct usb_device *udev, pm_message_t 
msg)
return status;
 }
 
-#ifdef CONFIG_PM
-
 int usb_remote_wakeup(struct usb_device *udev)
 {
int status = 0;
@@ -3512,16 +3510,6 @@ static int hub_handle_remote_wakeup(struct usb_hub *hub, 
unsigned int port,
return connect_change;
 }
 
-#else
-
-static int hub_handle_remote_wakeup(struct usb_hub *hub, unsigned int port,
-   u16 portstatus, u16 portchange)
-{
-   return 0;
-}
-
-#endif
-
 static int check_ports_changed(struct usb_hub *hub)
 {
int port1;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
2015-02-07 21:43 GMT+01:00 Paul Bolle :
> [Adding Tilman.]
>
> On Sat, 2015-02-07 at 11:19 -0800, Joe Perches wrote:
>> Does anyone still use these cards?
>
> 0) Good question.
>
> 1) None of the (two dozen) commits in drivers/isdn/act2000/ added since
> v2.6.12 appear to be triggered complaints, suggestions, etc. of actual
> users.
>
> 2) Broader picture: if I remember correctly there are now four different
> flavors of ISDN in the kernel:
> - really old: pre-i4l
> - very old: i4l
> - just old: CAPI
> - not so old: mISDN
>
> I could spend another 24 hours refining and relabeling these categories,
> and matching the various drivers to these categories. But I'm pretty
> sure none of the current categories contain all the drivers. And I'm
> certain all current categories support one or more drivers that none of
> the other categories do. So the current ISDN situation is a bit messy.
>
> Tilman might be able to provide a clearer, and maybe less grumpy,
> summary of the current situation.
>
> 3) Anyhow, this is an i4l card. i4l is deprecated since v2.6.22. And it
> was obsolete before that!
>
> 4) Furthermore, it seems consumer grade ISDN is on the way out. Eg, my
> ISP will disconnect my, let's call it, ADSL over ISDN connection in less
> that two months because they can't be bothered anymore to support that
> niche.
>
> 5) So we could let the various flavors of ISDN limp along for another
> few years. But maybe we should consider, say, removing i4l and pre i4l
> and see who complains. That might be a rude thing to do. So perhaps the
> various ISDN flavors should be left alone until ... what exactly?
>
>
> Paul Bolle
>

In that case I will drop this patchset. I thought it might have been
useful and a good way to learn
but I'm just wasting everyone's time with it if it's that deprecated.

Regards,

Bas
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/4] tridentfb: Add DDC support

2015-02-07 Thread Ondrej Zary
Add DDC support for Trident cards.

Tested on TGUI9440, TGUI9680, 3DImage 9750, Blade3D 9880 and Blade XP.

Signed-off-by: Ondrej Zary 
---
 drivers/video/fbdev/Kconfig |9 ++
 drivers/video/fbdev/tridentfb.c |  192 ++-
 2 files changed, 196 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 4916c97..08a7a04 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -1682,6 +1682,15 @@ config FB_TRIDENT
  To compile this driver as a module, choose M here: the
  module will be called tridentfb.
 
+config FB_TRIDENT_DDC
+   bool "DDC for Trident support"
+   depends on FB_TRIDENT
+   select FB_DDC
+   select FB_MODE_HELPERS
+   default y
+   help
+ Say Y here if you want DDC support for your Trident graphics card.
+
 config FB_ARK
tristate "ARK 2000PV support"
depends on FB && PCI
diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c
index 01b43e9..59471a0 100644
--- a/drivers/video/fbdev/tridentfb.c
+++ b/drivers/video/fbdev/tridentfb.c
@@ -25,6 +25,9 @@
 #include 
 #include 
 
+#include 
+#include 
+
 struct tridentfb_par {
void __iomem *io_virt;  /* iospace virtual memory address */
u32 pseudo_pal[16];
@@ -40,6 +43,11 @@ struct tridentfb_par {
(struct tridentfb_par *par, const char*,
 u32, u32, u32, u32, u32, u32);
unsigned char eng_oper; /* engine operation... */
+#ifdef CONFIG_FB_TRIDENT_DDC
+   bool ddc_registered;
+   struct i2c_adapter ddc_adapter;
+   struct i2c_algo_bit_data ddc_algo;
+#endif
 };
 
 static struct fb_fix_screeninfo tridentfb_fix = {
@@ -53,7 +61,7 @@ static struct fb_fix_screeninfo tridentfb_fix = {
 /* defaults which are normally overriden by user values */
 
 /* video mode */
-static char *mode_option = "640x480-8@60";
+static char *mode_option;
 static int bpp = 8;
 
 static int noaccel;
@@ -174,6 +182,124 @@ static inline u32 readmmr(struct tridentfb_par *par, u16 
r)
return fb_readl(par->io_virt + r);
 }
 
+#ifdef CONFIG_FB_TRIDENT_DDC
+
+#define DDC_SDA_TGUI   BIT(0)
+#define DDC_SCL_TGUI   BIT(1)
+#define DDC_SCL_DRIVE_TGUI BIT(2)
+#define DDC_SDA_DRIVE_TGUI BIT(3)
+#define DDC_MASK_TGUI  (DDC_SCL_DRIVE_TGUI | DDC_SDA_DRIVE_TGUI)
+
+static void tridentfb_ddc_setscl_tgui(void *data, int val)
+{
+   struct tridentfb_par *par = data;
+   u8 reg = vga_mm_rcrt(par->io_virt, I2C) & DDC_MASK_TGUI;
+
+   if (val)
+   reg &= ~DDC_SCL_DRIVE_TGUI; /* disable drive - don't drive hi */
+   else
+   reg |= DDC_SCL_DRIVE_TGUI; /* drive low */
+
+   vga_mm_wcrt(par->io_virt, I2C, reg);
+}
+
+static void tridentfb_ddc_setsda_tgui(void *data, int val)
+{
+   struct tridentfb_par *par = data;
+   u8 reg = vga_mm_rcrt(par->io_virt, I2C) & DDC_MASK_TGUI;
+
+   if (val)
+   reg &= ~DDC_SDA_DRIVE_TGUI; /* disable drive - don't drive hi */
+   else
+   reg |= DDC_SDA_DRIVE_TGUI; /* drive low */
+
+   vga_mm_wcrt(par->io_virt, I2C, reg);
+}
+
+static int tridentfb_ddc_getsda_tgui(void *data)
+{
+   struct tridentfb_par *par = data;
+
+   return !!(vga_mm_rcrt(par->io_virt, I2C) & DDC_SDA_TGUI);
+}
+
+#define DDC_SDA_IN BIT(0)
+#define DDC_SCL_OUTBIT(1)
+#define DDC_SDA_OUTBIT(3)
+#define DDC_SCL_IN BIT(6)
+#define DDC_MASK   (DDC_SCL_OUT | DDC_SDA_OUT)
+
+static void tridentfb_ddc_setscl(void *data, int val)
+{
+   struct tridentfb_par *par = data;
+   unsigned char reg;
+
+   reg = vga_mm_rcrt(par->io_virt, I2C) & DDC_MASK;
+   if (val)
+   reg |= DDC_SCL_OUT;
+   else
+   reg &= ~DDC_SCL_OUT;
+   vga_mm_wcrt(par->io_virt, I2C, reg);
+}
+
+static void tridentfb_ddc_setsda(void *data, int val)
+{
+   struct tridentfb_par *par = data;
+   unsigned char reg;
+
+   reg = vga_mm_rcrt(par->io_virt, I2C) & DDC_MASK;
+   if (!val)
+   reg |= DDC_SDA_OUT;
+   else
+   reg &= ~DDC_SDA_OUT;
+   vga_mm_wcrt(par->io_virt, I2C, reg);
+}
+
+static int tridentfb_ddc_getscl(void *data)
+{
+   struct tridentfb_par *par = data;
+
+   return !!(vga_mm_rcrt(par->io_virt, I2C) & DDC_SCL_IN);
+}
+
+static int tridentfb_ddc_getsda(void *data)
+{
+   struct tridentfb_par *par = data;
+
+   return !!(vga_mm_rcrt(par->io_virt, I2C) & DDC_SDA_IN);
+}
+
+static int tridentfb_setup_ddc_bus(struct fb_info *info)
+{
+   struct tridentfb_par *par = info->par;
+
+   strlcpy(par->ddc_adapter.name, info->fix.id,
+   sizeof(par->ddc_adapter.name));
+   par->ddc_adapter.owner  = THIS_MODULE;
+   par->ddc_adapter.class  = I2C_CLASS_DDC;
+   par->ddc_adapter.algo_data  = >ddc_algo;
+   par->ddc_adapter.dev.parent = info->device;
+   if 

[PATCH 3/4] fb_ddc: Allow I2C adapters without SCL read capability

2015-02-07 Thread Ondrej Zary
i2c-algo-bit allows I2C adapters without SCL read capability to work but
fb_ddc_read fails to work on them.

Fix fb_ddc_read to work with I2C adapters not capable of reading SCL.

Signed-off-by: Ondrej Zary 
---
 drivers/video/fbdev/core/fb_ddc.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/video/fbdev/core/fb_ddc.c 
b/drivers/video/fbdev/core/fb_ddc.c
index 94322cc..22c694a 100644
--- a/drivers/video/fbdev/core/fb_ddc.c
+++ b/drivers/video/fbdev/core/fb_ddc.c
@@ -69,10 +69,11 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
algo_data->setscl(algo_data->data, 1);
for (j = 0; j < 5; j++) {
msleep(10);
-   if (algo_data->getscl(algo_data->data))
+   if (algo_data->getscl &&
+   algo_data->getscl(algo_data->data))
break;
}
-   if (j == 5)
+   if (algo_data->getscl && j == 5)
continue;
 
algo_data->setsda(algo_data->data, 0);
@@ -91,7 +92,8 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter)
algo_data->setscl(algo_data->data, 1);
for (j = 0; j < 10; j++) {
msleep(10);
-   if (algo_data->getscl(algo_data->data))
+   if (algo_data->getscl &&
+   algo_data->getscl(algo_data->data))
break;
}
 
-- 
Ondrej Zary

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/4] tridentfb: Fix set_lwidth on TGUI9440 and CYBER9320

2015-02-07 Thread Ondrej Zary
According to X.Org driver, chips older than TGUI9660 have only 1 width bit
in AddColReg. Touching the 2nd one causes I2C/DDC to fail on TGUI9440.

Set only 1 bit of width in AddColReg on TGUI9440 and CYBER9320.

Signed-off-by: Ondrej Zary 
---
 drivers/video/fbdev/tridentfb.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c
index 7429713..01b43e9 100644
--- a/drivers/video/fbdev/tridentfb.c
+++ b/drivers/video/fbdev/tridentfb.c
@@ -673,8 +673,14 @@ static int get_nativex(struct tridentfb_par *par)
 static inline void set_lwidth(struct tridentfb_par *par, int width)
 {
write3X4(par, VGA_CRTC_OFFSET, width & 0xFF);
-   write3X4(par, AddColReg,
-(read3X4(par, AddColReg) & 0xCF) | ((width & 0x300) >> 4));
+   /* chips older than TGUI9660 have only 1 width bit in AddColReg */
+   /* touching the other one breaks I2C/DDC */
+   if (par->chip_id == TGUI9440 || par->chip_id == CYBER9320)
+   write3X4(par, AddColReg,
+(read3X4(par, AddColReg) & 0xEF) | ((width & 0x100) >> 4));
+   else
+   write3X4(par, AddColReg,
+(read3X4(par, AddColReg) & 0xCF) | ((width & 0x300) >> 4));
 }
 
 /* For resolutions smaller than FP resolution stretch */
-- 
Ondrej Zary

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/4] tridentfb: fix hang on Blade3D with CONFIG_CC_OPTIMIZE_FOR_SIZE

2015-02-07 Thread Ondrej Zary
When the kernel is compiled with -Os (CONFIG_CC_OPTIMIZE_FOR_SIZE), tridentfb
hangs the machine upon load with Blade3D cards unless acceleration is disabled.

This is caused by memcpy() which copies data byte-by-byte (rep movsb) when
compiled with -Os. The card does not like that - it requires 32-bit access.

Use iowrite_32() instead.

Signed-off-by: Ondrej Zary 
---
 drivers/video/fbdev/tridentfb.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/tridentfb.c b/drivers/video/fbdev/tridentfb.c
index 7ed9a22..7429713 100644
--- a/drivers/video/fbdev/tridentfb.c
+++ b/drivers/video/fbdev/tridentfb.c
@@ -226,7 +226,7 @@ static void blade_image_blit(struct tridentfb_par *par, 
const char *data,
writemmr(par, DST1, point(x, y));
writemmr(par, DST2, point(x + w - 1, y + h - 1));
 
-   memcpy(par->io_virt + 0x1, data, 4 * size);
+   iowrite32_rep(par->io_virt + 0x1, data, size);
 }
 
 static void blade_copy_rect(struct tridentfb_par *par,
-- 
Ondrej Zary

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Paul Bolle
[Adding Tilman.]

On Sat, 2015-02-07 at 11:19 -0800, Joe Perches wrote:
> Does anyone still use these cards?

0) Good question.

1) None of the (two dozen) commits in drivers/isdn/act2000/ added since
v2.6.12 appear to be triggered complaints, suggestions, etc. of actual
users.

2) Broader picture: if I remember correctly there are now four different
flavors of ISDN in the kernel:
- really old: pre-i4l
- very old: i4l
- just old: CAPI
- not so old: mISDN

I could spend another 24 hours refining and relabeling these categories,
and matching the various drivers to these categories. But I'm pretty
sure none of the current categories contain all the drivers. And I'm
certain all current categories support one or more drivers that none of
the other categories do. So the current ISDN situation is a bit messy.

Tilman might be able to provide a clearer, and maybe less grumpy,
summary of the current situation.

3) Anyhow, this is an i4l card. i4l is deprecated since v2.6.22. And it
was obsolete before that!

4) Furthermore, it seems consumer grade ISDN is on the way out. Eg, my
ISP will disconnect my, let's call it, ADSL over ISDN connection in less
that two months because they can't be bothered anymore to support that
niche. 

5) So we could let the various flavors of ISDN limp along for another
few years. But maybe we should consider, say, removing i4l and pre i4l
and see who complains. That might be a rude thing to do. So perhaps the
various ISDN flavors should be left alone until ... what exactly?


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] KVM: x86: optimize delivery of TSC deadline timer interrupt

2015-02-07 Thread Paolo Bonzini


On 06/02/2015 21:51, Marcelo Tosatti wrote:
> On Fri, Feb 06, 2015 at 01:16:59PM +0100, Paolo Bonzini wrote:
>> The newly-added tracepoint shows the following results on
>> the tscdeadline_latency test:
>>
>> qemu-kvm-8387  [002]  6425.558974: kvm_vcpu_wakeup:  poll time 
>> 10407 ns
>> qemu-kvm-8387  [002]  6425.558984: kvm_vcpu_wakeup:  poll time 0 
>> ns
>> qemu-kvm-8387  [002]  6425.561242: kvm_vcpu_wakeup:  poll time 
>> 10477 ns
>> qemu-kvm-8387  [002]  6425.561251: kvm_vcpu_wakeup:  poll time 0 
>> ns
>>
>> and so on.  This is because we need to go through kvm_vcpu_block again
>> after the timer IRQ is injected.  Avoid it by polling once before
>> entering kvm_vcpu_block.
>>
>> On my machine (Xeon E5 Sandy Bridge) this removes about 500 cycles (7%)
>> from the latency of the TSC deadline timer.
>>
>> Signed-off-by: Paolo Bonzini 
>> ---
>>  arch/x86/kvm/x86.c | 14 +-
>>  1 file changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index 0b8dd13676ef..1e766033ebff 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -6389,11 +6389,15 @@ static inline int __vcpu_run(struct kvm *kvm, struct 
>> kvm_vcpu *vcpu)
>>  !vcpu->arch.apf.halted)
>>  return vcpu_enter_guest(vcpu);
>>  
>> -srcu_read_unlock(>srcu, vcpu->srcu_idx);
>> -kvm_vcpu_block(vcpu);
>> -vcpu->srcu_idx = srcu_read_lock(>srcu);
>> -if (!kvm_check_request(KVM_REQ_UNHALT, vcpu))
>> -return 1;
>> +if (kvm_arch_vcpu_runnable(vcpu))
>> +clear_bit(KVM_REQ_UNHALT, >requests);
>> +else {
> 
> Why the clear_bit? Since only kvm_vcpu_block in the below section
> sets it, and that section clears it as well.

You're right.

> Can remove another 300 cycles from do_div when programming LAPIC
> tscdeadline timer.

Do you mean using something like lib/reciprocal_div.c?  Good idea,
though that's not latency, it's just being slow. :)

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86/tbl/trace: Do not trace on CPU that is offline

2015-02-07 Thread Sedat Dilek
On Sat, Feb 7, 2015 at 9:09 PM, Paul E. McKenney
 wrote:
> On Sat, Feb 07, 2015 at 10:20:02AM -0500, Steven Rostedt wrote:
>> On Sat, 7 Feb 2015 09:01:34 +0100
>> Sedat Dilek  wrote:
>>
>>
>> > - Tested-by's
>> > - Reference of 2/2 to 1/2
>>
>> The two are together in the series and fix two different bugs. They do
>> not need to reference each other.
>>
>> > - CC: stable v3.17+/v3.18+ ? (1/2 has a hint for backporting in case
>> > of 3.17+ which is BTW EOL, not sure if there are main distros
>> > supporting linux-3.17.y)
>>
>> The first patch fixes a bug introduced in 3.18. There would be no splat
>> in 3.17 because the check didn't exist then. But the RCU reference
>> while cpu offline (second bug) was introduced in 3.17 and that is what
>> the second patch fixes.
>>
>> >
>> > BTW, do you happen to know if there is a someting like a
>> > "Requires-tag" or "Precondition-tag" (for example the Fixes-tag is
>> > very helpful)?
>>
>> We don't need more tags.
>>
>> > AFAICS people place such information into the commit-message.
>> > I have seen "References:" but this is more to point to a
>> > bug-tracking-system (BTS).
>> >
>> > EXAMPLE:
>> >
>> > commit 63b03e2d2477586440741677ecac45bcf28d7b1
>> > "mutex: Always clear owner field upon mutex_unlock()"
>> >
>> > References: https://bugs.freedesktop.org/show_bug.cgi?id=87955
>> >
>>
>> I may add that, but more appropriate would be to add the commit that
>> fixes the bug to the bug report.
>>
>> > Maybe ask godfather of SubmittingPatches greg-kh?
>>
>> Heh, I haven't read that document in years.
>
> Given my confusion about stable tags, I read stable_kernel_rules.txt
> the other day, and found this:
>
>  - If the patch requires other patches as prerequisites which can be
>cherry-picked, then this can be specified in the following format in
>the sign-off area:
>
>  Cc:  # 3.3.x: a1f84a3: sched: Check for idle
>  Cc:  # 3.3.x: 1b9508f: sched: Rate-limit newidle
>  Cc:  # 3.3.x: fd21073: sched: Fix affinity logic
>  Cc:  # 3.3.x
> Signed-off-by: Ingo Molnar 
>
>The tag sequence has the meaning of:
>  git cherry-pick a1f84a3
>  git cherry-pick 1b9508f
>  git cherry-pick fd21073
>  git cherry-pick 
>
> Does that do what you need?
>

( Bah, I had a look recently into rules.txt in stable-queue.git. )
That sounds cool and is what I wanted.

Thanks, Paul!

- Sedat -

[1] 
http://git.kernel.org/cgit/linux/kernel/git/stable/stable-queue.git/tree/rules.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] classmate-laptop: fix sparse warning

2015-02-07 Thread Darren Hart
On Thu, Feb 05, 2015 at 02:57:44PM +, Lad Prabhakar wrote:
> From: "Lad, Prabhakar" 
> 
> this patch fixes following sparse warning:
> 
> classmate-laptop.c:523:61: warning: Using plain integer as NULL pointer
> 
> Signed-off-by: Lad, Prabhakar 

Queued, thanks Lad.

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Sony-laptop: fix sparse warning

2015-02-07 Thread Darren Hart
On Thu, Feb 05, 2015 at 02:49:41PM +, Lad Prabhakar wrote:
> From: "Lad, Prabhakar" 
> 
> this patch fixes following sparse warning:
> 
> sony-laptop.c:1035:29: warning: symbol 'sony_bl_props' was not declared. 
> Should it be static?
> 
> Signed-off-by: Lad, Prabhakar 

Queued, thanks Lad.

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86/tbl/trace: Do not trace on CPU that is offline

2015-02-07 Thread Paul E. McKenney
On Sat, Feb 07, 2015 at 10:20:02AM -0500, Steven Rostedt wrote:
> On Sat, 7 Feb 2015 09:01:34 +0100
> Sedat Dilek  wrote:
> 
> 
> > - Tested-by's
> > - Reference of 2/2 to 1/2
> 
> The two are together in the series and fix two different bugs. They do
> not need to reference each other.
> 
> > - CC: stable v3.17+/v3.18+ ? (1/2 has a hint for backporting in case
> > of 3.17+ which is BTW EOL, not sure if there are main distros
> > supporting linux-3.17.y)
> 
> The first patch fixes a bug introduced in 3.18. There would be no splat
> in 3.17 because the check didn't exist then. But the RCU reference
> while cpu offline (second bug) was introduced in 3.17 and that is what
> the second patch fixes.
> 
> > 
> > BTW, do you happen to know if there is a someting like a
> > "Requires-tag" or "Precondition-tag" (for example the Fixes-tag is
> > very helpful)?
> 
> We don't need more tags.
> 
> > AFAICS people place such information into the commit-message.
> > I have seen "References:" but this is more to point to a
> > bug-tracking-system (BTS).
> > 
> > EXAMPLE:
> > 
> > commit 63b03e2d2477586440741677ecac45bcf28d7b1
> > "mutex: Always clear owner field upon mutex_unlock()"
> > 
> > References: https://bugs.freedesktop.org/show_bug.cgi?id=87955
> > 
> 
> I may add that, but more appropriate would be to add the commit that
> fixes the bug to the bug report.
> 
> > Maybe ask godfather of SubmittingPatches greg-kh?
> 
> Heh, I haven't read that document in years.

Given my confusion about stable tags, I read stable_kernel_rules.txt
the other day, and found this:

 - If the patch requires other patches as prerequisites which can be
   cherry-picked, then this can be specified in the following format in
   the sign-off area:

 Cc:  # 3.3.x: a1f84a3: sched: Check for idle
 Cc:  # 3.3.x: 1b9508f: sched: Rate-limit newidle
 Cc:  # 3.3.x: fd21073: sched: Fix affinity logic
 Cc:  # 3.3.x
Signed-off-by: Ingo Molnar 

   The tag sequence has the meaning of:
 git cherry-pick a1f84a3
 git cherry-pick 1b9508f
 git cherry-pick fd21073
 git cherry-pick 

Does that do what you need?

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Sony-laptop: fix sparse warning

2015-02-07 Thread Darren Hart
On Sat, Feb 07, 2015 at 12:33:16PM +0100, Bjørn Mork wrote:
> Darren Hart  writes:
> > On Thu, Feb 05, 2015 at 04:00:32PM +, Lad, Prabhakar wrote:
> >
> >> Lad, Prabhakar 
> >> Lad, Prabhakar 
> >
> > I think there may be a problem with this in an unquoted email address. The
> > unquoted local part, per RFC 2822 3.4.1, can only contain  
> > !#$%'*+-/=?^_`{|}~
> > and . separators.
> 
> Yes, but that is not applicable to the git commit tags.  They are not
> RFC2822 header fields.  Nothing will ever parse "Lad" as an unqualified
> local destination in a SOB, and therefore there is no problem using the
> comma there.

Also, my reading was incorrect as "local part" refers to the text preceeding
the @ character, not the text outside the <>. So, while the name should probably
be quoted to avoid problems with MUAs interpretting the , as a list separator, I
don't have anything definitive to reference to prevent it. So at least for now,
I'll be accepting Lad's contributions as is, comma and all :-)

I really dislike this aspect of our tooling. Being so free form, it's
inevitiable for even seasoned contributors to trip over these sort of implicit
rules. It seems to me that a very significant, perhaps not the majority, of the
time I spend as maintainer is dealing with things like coding style, commit
message formatting, and similar issues. I can sympathize with those who
criticize our mechanisms as archaic :-/

> 
> Note that names using non-ascii characters are often written without
> quotes i SOBs (wonder how I know this? :-).  In practice I believe the
> character set is only limited by what you will allow in your git log.
> The only characters with a special meaning are :<>#, and the latter is
> somewhat dubious.  But it's often used as a comment separator in stable
> CCs, so I guess it should be avoided for other uses.
> 
> Scripts etc trying to parse these tags into email headers must be
> prepared to do the necessary stripping and quoting of any text outside
> the <> brackets.
> 
> Requiring a full name is of course good for accountability, but do let
> people format their names as they want them to appear in the log.
> Different cultures have different traditions. Wookey has collected a few
> links on this subject if anyone is interested:
> http://wookware.org/name.html
> 

Thanks Bjørn :-)

> 
> Bjørn
> 

-- 
Darren Hart
Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] rcu,nohz: add state parameter to context_tracking_user_enter/exit

2015-02-07 Thread Paul E. McKenney
On Sat, Feb 07, 2015 at 09:30:41AM +0100, Frederic Weisbecker wrote:
> On Fri, Feb 06, 2015 at 11:14:53PM -0800, Paul E. McKenney wrote:
> > On Fri, Feb 06, 2015 at 10:34:21PM -0800, Paul E. McKenney wrote:
> > > On Fri, Feb 06, 2015 at 10:53:34PM -0500, Rik van Riel wrote:
> > > > -BEGIN PGP SIGNED MESSAGE-
> > > > Hash: SHA1
> > > > 
> > > > On 02/06/2015 06:15 PM, Frederic Weisbecker wrote:
> > > > 
> > > > > Just a few things then:
> > > > > 
> > > > > 1) In this case rename context_tracking_user_enter/exit() to 
> > > > > context_tracking_enter() and context_tracking_exit(), since it's
> > > > > not anymore about user only but about any generic context.
> > > > > 
> > > > > 2) We have the "WARN_ON_ONCE(!current->mm);" condition that is a
> > > > > debug check specific to userspace transitions because kernel
> > > > > threads aren't expected to resume to userspace. Can we also expect
> > > > > that we never switch to/from guest from a kernel thread? AFAICS
> > > > > this happens from an ioctl (thus user task) in x86 for kvm. But I
> > > > > only know this case.
> > > > > 
> > > > > 3) You might want to update a few comments that assume we only deal
> > > > > with userspace transitions.
> > > > > 
> > > > > 4) trace_user_enter/exit() should stay user-transitions specific.
> > > > 
> > > > Paul, would you like me to send follow-up patches with the cleanups
> > > > suggested by Frederic, or would you prefer me to send a new series
> > > > with the cleanups integrated?
> > > 
> > > I would prefer a new series, in order to prevent possible future
> > > confusion.
> > 
> > Of course, if Frederic would rather push them himself, I am fine with
> > that.  And in that case, you should ask him for his preferences, which
> > just might differ from mine.  ;-)
> 
> I prefer a new series too. Now whether you or me take the patches, I don't 
> mind
> either way :-)
> 
> Also I wonder how this feature is going to be enabled. Will it be enabled on
> full dynticks or should it be a seperate feature depending on full dynticks?
> Or even just CONFIG_RCU_USER_EQS? Because I'm still unclear about how and what
> this is used, if it involves full dynticks or only RCU extended quiescent 
> states.

Well, we certainly need it documented.  And validation considerations
would push for keeping the number of possible combinations low, while
paranoia about added feature would push for having it be separately
enabled.  And if distros are going to enable this at build time, we
either need -serious- validation or a way to disable at boot time.

On the desired/required combinations of features, let's see...

If I understand this completely, which I probably don't, we have the
following considerations:

o   NO_HZ_FULL: Needed to get rid of the scheduling-clock interrupt
during guest execution, though I am not sure whether we really
have that completely wired up with this patch set.  Regardless,
Rik, for your use case, do you care about whether or not the
guest gets interrupted by the host's scheduling-clock interrupts?
(Based on discussion in this thread, my guess is "yes".)

o   RCU_NOCB_CPUS: Implied by NO_HZ_FULL, but only on CPUs actually
enabled for NO_HZ_FULL operation, either by NO_HZ_FULL_ALL
at build time or by nohz_full= at boot time.  Needed to avoid
interrupting the guest with host RCU callback invocation.
Rik, does your use case care about guests being interrupted
by RCU callback invocation?  (Based on discussion in this thread,
my guess is "yes".)

o   RCU_USER_EQS: Implied by NO_HZ_FULL, and I would have to go look
to see what relation this has to nohz_full=.  Needed for RCU to be
able to recognize userspace-execution quiescent states on a given
CPU without disturbing that CPU.  Unless I am missing something
subtle, you have to have this for this patch series to make sense.

If my guesses are correct, the best approach would be to have this
new mode of operation implied by NO_HZ_FULL.  The patches seem simple
enough that killer validation should be practical, which would avoid
further complication of the Kconfig combinatorial space.

So, are my guesses correct?

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3] net: bluetooth: hci_sock: Use 'const u32 *' instead of 'void *' for 2nd parameter of hci_test_bit()

2015-02-07 Thread Joe Perches
On Sat, 2015-02-07 at 21:24 +0800, Chen Gang S wrote:
> hci_test_bit() does not modify 2nd parameter, so it is better to let it
> be constant, or may cause build warning. The related warning (with
> allmodconfig under xtensa):
> 
>   net/bluetooth/hci_sock.c: In function 'hci_sock_sendmsg':
>   net/bluetooth/hci_sock.c:955:8: warning: passing argument 2 of 
> 'hci_test_bit' discards 'const' qualifier from pointer target type 
> [-Wdiscarded-array-qualifiers]
>   _sec_filter.ocf_mask[ogf])) &&
>   ^
>   net/bluetooth/hci_sock.c:49:19: note: expected 'void *' but argument is of 
> type 'const __u32 (*)[4] {aka const unsigned int (*)[4]}'
>static inline int hci_test_bit(int nr, void *addr)
>  ^
> 
> hci_test_bit() always treats 2nd parameter is u32, and all callers also
> know about it, so 2nd parameter of hci_test_bit() need use 'const u32 *'
> instead of 'void *'.
> 
> C language treats the array function parameter as a pointer, so the
> caller need not use '&' for the 2 demotion array, or it reports warning:
> 'const unsigned int (*)[4]' is different with 'const unsigned int *'.

I still think you are possibly papering over potential bugs
on big-endian 64 bit systems.

unsigned long vs u32.

How are the bits actually set?


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] x86/tbl/trace: Do not trace on CPU that is offline

2015-02-07 Thread Sedat Dilek
On Sat, Feb 7, 2015 at 4:20 PM, Steven Rostedt  wrote:
> On Sat, 7 Feb 2015 09:01:34 +0100
> Sedat Dilek  wrote:
>
>
>> - Tested-by's
>> - Reference of 2/2 to 1/2
>
> The two are together in the series and fix two different bugs. They do
> not need to reference each other.
>
>> - CC: stable v3.17+/v3.18+ ? (1/2 has a hint for backporting in case
>> of 3.17+ which is BTW EOL, not sure if there are main distros
>> supporting linux-3.17.y)
>
> The first patch fixes a bug introduced in 3.18. There would be no splat
> in 3.17 because the check didn't exist then. But the RCU reference
> while cpu offline (second bug) was introduced in 3.17 and that is what
> the second patch fixes.
>
>>
>> BTW, do you happen to know if there is a someting like a
>> "Requires-tag" or "Precondition-tag" (for example the Fixes-tag is
>> very helpful)?
>
> We don't need more tags.
>
>> AFAICS people place such information into the commit-message.
>> I have seen "References:" but this is more to point to a
>> bug-tracking-system (BTS).
>>
>> EXAMPLE:
>>
>> commit 63b03e2d2477586440741677ecac45bcf28d7b1
>> "mutex: Always clear owner field upon mutex_unlock()"
>>
>> References: https://bugs.freedesktop.org/show_bug.cgi?id=87955
>>
>
> I may add that, but more appropriate would be to add the commit that
> fixes the bug to the bug report.
>
>> Maybe ask godfather of SubmittingPatches greg-kh?
>>
>
> Heh, I haven't read that document in years.
>

Thanks for commenting.

Feel free to add my Tested-by to 2/2.

- Sedat -
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Joe Perches
On Sat, 2015-02-07 at 20:51 +0300, Sergei Shtylyov wrote:
> On 02/07/2015 08:06 PM, Bas Peters wrote:
> 
> > This patch fixes the following checkpatch errors:
> > 1. trailing statement
> > 1. assignment of variable in if condition
> > 1. incorrectly placed brace after function definition

I wonder about the usefulness of these changes.

Does anyone still use these cards?

> > diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
[]
> > @@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
> > m->hdr.cmd.cmd = c; \
> > m->hdr.cmd.subcmd = s;  \
> > m->hdr.msgnum = actcapi_nextsmsg(card); \
> > -   } else m = NULL;\
> > +   } else
> > +   m = NULL;   \
> 
> Documentation/CodingStyle has an extra rule for such case: *else* branch 
> should also have {} since *if* branch has {}.

The macro itself is already poor form.
-
#define ACTCAPI_MKHDR(l, c, s) {\
skb = alloc_skb(l + 8, GFP_ATOMIC); \
if (skb) {  \
m = (actcapi_msg *)skb_put(skb, l + 8); \
m->hdr.len = l + 8; \
m->hdr.applicationID = 1;   \
m->hdr.cmd.cmd = c; \
m->hdr.cmd.subcmd = s;  \
m->hdr.msgnum = actcapi_nextsmsg(card); \
} else m = NULL;\
}
-

o hidden arguments skb, m and card
o missing do {} while around multi-statement macro

It'd probably be nicer to change the macro to a function
and pass m and card.

This would reduce the object size too.

But maybe any change here is not necessary.

If anything is done, I suggest something like:
---
 drivers/isdn/act2000/capi.c | 204 +---
 1 file changed, 115 insertions(+), 89 deletions(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 3f66ca2..a7ecf51 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -104,29 +104,36 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
return 0;
 }
 
-#define ACTCAPI_MKHDR(l, c, s) {   \
-   skb = alloc_skb(l + 8, GFP_ATOMIC); \
-   if (skb) {  \
-   m = (actcapi_msg *)skb_put(skb, l + 8); \
-   m->hdr.len = l + 8; \
-   m->hdr.applicationID = 1;   \
-   m->hdr.cmd.cmd = c; \
-   m->hdr.cmd.subcmd = s;  \
-   m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else m = NULL;\
-   }
+static struct sk_buff *actcapi_mkhdr(act2000_card *card, actcapi_msg **m,
+int len, int cmd, int subcmd)
+{
+   struct sk_buff *skb;
 
-#define ACTCAPI_CHKSKB if (!skb) { \
-   printk(KERN_WARNING "actcapi: alloc_skb failed\n"); \
-   return; \
-   }
+   len += 8;
 
-#define ACTCAPI_QUEUE_TX { \
-   actcapi_debug_msg(skb, 1);  \
-   skb_queue_tail(>sndq, skb);   \
-   act2000_schedule_tx(card);  \
+   skb = alloc_skb(len, GFP_ATOMIC);
+   if (!skb) {
+   *m = NULL;
+   return NULL;
}
 
+   *m = (actcapi_msg *)skb_put(skb, len);
+   (*m)->hdr.len = len;
+   (*m)->hdr.applicationID = 1;
+   (*m)->hdr.cmd.cmd = cmd;
+   (*m)->hdr.cmd.subcmd = subcmd;
+   (*m)->hdr.msgnum = actcapi_nextsmsg(card);
+
+   return skb;
+}
+
+static void actcapi_queue_tx(act2000_card *card, struct sk_buff *skb)
+{
+   actcapi_debug_msg(skb, 1);
+   skb_queue_tail(>sndq, skb);
+   act2000_schedule_tx(card);
+}
+
 int
 actcapi_listen_req(act2000_card *card)
 {
@@ -137,16 +144,15 @@ actcapi_listen_req(act2000_card *card)
 
for (i = 0; i < ACT2000_BCH; i++)
eazmask |= card->bch[i].eazmask;
-   ACTCAPI_MKHDR(9, 0x05, 0x00);
-   if (!skb) {
-   printk(KERN_WARNING "actcapi: alloc_skb failed\n");
+   skb = actcapi_mkhdr(card, , 9, 0x05, 0x00);
+   if (!skb)
return -ENOMEM;
-   }
+
m->msg.listen_req.controller = 0;
m->msg.listen_req.infomask = 0x3f; /* All information */
m->msg.listen_req.eazmask = eazmask;
m->msg.listen_req.simask = (eazmask) 

Re: [PATCH 7/7] drivers: isdn: act2000: capi.c: add macro \ and fix brace

2015-02-07 Thread Julia Lawall
On Sat, 7 Feb 2015, Bas Peters wrote:

> This patch adds the \ that was accidentally deleted in patch 2. It also adds 
> a brace after the else statement, which is required due to the fact that the 
> if statement has braces.

You should fix the patch that was incorrect, rather than submitting a 
patch that does something incorrect and then another patch to fix it.  The 
kernel should compile after every patch.

julia

> 
> ---
>  drivers/isdn/act2000/capi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
> index 5d677e6..0043b3c 100644
> --- a/drivers/isdn/act2000/capi.c
> +++ b/drivers/isdn/act2000/capi.c
> @@ -113,8 +113,9 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
>   m->hdr.cmd.cmd = c; \
>   m->hdr.cmd.subcmd = s;  \
>   m->hdr.msgnum = actcapi_nextsmsg(card); \
> - } else
> + } else {\
>   m = NULL;   \
> + }   \
>   }
>  
>  #define ACTCAPI_CHKSKB if (!skb) {   \
> -- 
> 2.1.0
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 7/7] drivers: isdn: act2000: capi.c: add macro \ and fix brace

2015-02-07 Thread Sergei Shtylyov

On 02/07/2015 10:05 PM, Bas Peters wrote:


This patch adds the \ that was accidentally deleted in patch 2. It also adds a 
brace after the else statement, which is required due to the fact that the if 
statement has braces.


   This won't do, fix up the patch #2 please. And please wrap your change log 
at 80 columns or less. And you forgot to sign off anyway. :-)


[...]

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/7] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Sergei Shtylyov

On 02/07/2015 10:05 PM, Bas Peters wrote:


This patch fixes the following checkpatch errors:
1. trailing statement
1. assignment of variable in if condition
1. incorrectly placed brace after function definition



Signed-off-by: Bas Peters 
---
  drivers/isdn/act2000/capi.c | 9 ++---
  1 file changed, 6 insertions(+), 3 deletions(-)



diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 3f66ca2..5d677e6 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m->hdr.cmd.cmd = c;  \
m->hdr.cmd.subcmd = s;   \
m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else m = NULL;\
+   } else


   Backslash is still missing here.


+   m = NULL;   \
}

  #define ACTCAPI_CHKSKB if (!skb) {\

[...]

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/7] drivers: isdn: act2000: module.c: remove NULL-initialization of static variable.

2015-02-07 Thread Bas Peters
GCC takes care of this for us, thus it is not needed and theoretically
only hoggs memory, allbeit only a bit.
---
 drivers/isdn/act2000/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 352916a..9359b36 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -28,7 +28,7 @@ static unsigned short act2000_isa_ports[] =
 static act2000_card *cards = (act2000_card *) NULL;
 
 /* Parameters to be set by insmod */
-static int   act_bus  =  0;
+static int   act_bus;
 static int   act_port = -1;  /* -1 = Autoprobe  */
 static int   act_irq  = -1;
 static char *act_id   = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/7] drivers: isdn: act2000: module.c: remove parenthesres around return values.

2015-02-07 Thread Bas Peters
return is not a function, therefore parentheses are not needed.
---
 drivers/isdn/act2000/module.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 9359b36..889ffcb 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -111,7 +111,7 @@ act2000_find_eaz(act2000_card *card, char eaz)
 
while (p) {
if (p->eaz == eaz)
-   return (p->msn);
+   return p->msn;
p = p->next;
}
return ("\0");
@@ -293,7 +293,7 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (ret)
return ret;
if (card->flags & ACT2000_FLAGS_RUNNING)
-   return (actcapi_manufacturer_req_msn(card));
+   return actcapi_manufacturer_req_msn(card);
return 0;
case ACT2000_IOCTL_ADDCARD:
if (copy_from_user(, arg,
@@ -520,7 +520,7 @@ if_command(isdn_ctrl *c)
act2000_card *card = act2000_findcard(c->driver);
 
if (card)
-   return (act2000_command(card, c));
+   return act2000_command(card, c);
printk(KERN_ERR
   "act2000: if_command %d called with invalid driverId %d!\n",
   c->command, c->driver);
@@ -535,7 +535,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (len);
+   return len;
}
printk(KERN_ERR
   "act2000: if_writecmd called with invalid driverId!\n");
@@ -550,7 +550,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_readstatus(buf, len, card));
+   return act2000_readstatus(buf, len, card);
}
printk(KERN_ERR
   "act2000: if_readstatus called with invalid driverId!\n");
@@ -565,7 +565,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff 
*skb)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_sendbuf(card, channel, ack, skb));
+   return act2000_sendbuf(card, channel, ack, skb);
}
printk(KERN_ERR
   "act2000: if_sendbuf called with invalid driverId!\n");
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 7/7] drivers: isdn: act2000: capi.c: add macro \ and fix brace

2015-02-07 Thread Bas Peters
This patch adds the \ that was accidentally deleted in patch 2. It also adds a 
brace after the else statement, which is required due to the fact that the if 
statement has braces.

---
 drivers/isdn/act2000/capi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 5d677e6..0043b3c 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,8 +113,9 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m->hdr.cmd.cmd = c; \
m->hdr.cmd.subcmd = s;  \
m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else
+   } else {\
m = NULL;   \
+   }   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   >