Re: [PATCH] sdhci: rtsx: fix 64 BIT DMA quirks

2015-04-08 Thread Ulf Hansson
On 7 April 2015 at 05:32,   wrote:
> From: Micky Ching 
>
> rts5250 chip failed handle 64 bit ADMA for address below 4G.
> Add 64 BIT quirks to disable this feature.
>
> Signed-off-by: Micky Ching 

Thanks! Applied, with a minor updated commit message header.

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-pci.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
> index 0342775..ae8e450 100644
> --- a/drivers/mmc/host/sdhci-pci.c
> +++ b/drivers/mmc/host/sdhci-pci.c
> @@ -650,6 +650,7 @@ static int rtsx_probe_slot(struct sdhci_pci_slot *slot)
>
>  static const struct sdhci_pci_fixes sdhci_rtsx = {
> .quirks2= SDHCI_QUIRK2_PRESET_VALUE_BROKEN |
> +   SDHCI_QUIRK2_BROKEN_64_BIT_DMA |
> SDHCI_QUIRK2_BROKEN_DDR50,
> .probe_slot = rtsx_probe_slot,
>  };
> --
> 1.9.1
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] media: cxd2099: move pre-init values out of init()

2015-04-08 Thread Mauro Carvalho Chehab
Em Sun, 8 Feb 2015 20:55:36 +
luisbg  escreveu:

> Improve code readability by moving out all pre-init values from the init
> function.
> 
> Signed-off-by: Luis de Bethencourt 
> ---
>  drivers/staging/media/cxd2099/cxd2099.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/cxd2099/cxd2099.c 
> b/drivers/staging/media/cxd2099/cxd2099.c
> index 657ea48..bafe36f 100644
> --- a/drivers/staging/media/cxd2099/cxd2099.c
> +++ b/drivers/staging/media/cxd2099/cxd2099.c
> @@ -300,7 +300,6 @@ static int init(struct cxd *ci)
>   int status;
>  
>   mutex_lock(&ci->lock);
> - ci->mode = -1;
>   do {
>   status = write_reg(ci, 0x00, 0x00);
>   if (status < 0)
> @@ -420,7 +419,6 @@ static int init(struct cxd *ci)
>   status = write_regm(ci, 0x09, 0x08, 0x08);
>   if (status < 0)
>   break;
> - ci->cammode = -1;
>   cam_mode(ci, 0);
>   } while (0);
>   mutex_unlock(&ci->lock);
> @@ -711,6 +709,8 @@ struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg 
> *cfg,
>  
>   ci->en = en_templ;
>   ci->en.data = ci;
> + ci->mode = -1;
> + ci->cammode = -1;

This actually changes the logic, as, cammode is == -1 only if the
do {} while loop succeeds.

Also, calling cam_mode(ci, 0) will change cammode to 0. Btw, for
it to work, ci->mode should be initialized earlier.

So, this patch looks very wrong on my eyes, except if you found
a real bug on it.

Have you tested it on a real device? What bug does it fix?

Regards,
Mauro

>   init(ci);
>   dev_info(&i2c->dev, "Attached CXD2099AR at %02x\n", ci->cfg.adr);
>   return &ci->en;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch] staging: rtl8712: freeing an ERR_PTR

2015-04-08 Thread Dan Carpenter
If memdup_user() fails then "pparmbuf" is an error pointer and we can't
pass it to kfree().  I changed the "goto _r871x_mp_ioctl_hdl_exit" to a
direct return.

I changed the earlier goto to a direct return as well for consistency
and removed the "pparmbuf = NULL" initializer since it's no longer
needed.

Fixes: 45de432775d6 ('Staging: rtl8712: Use memdup_user() instead of 
copy_from_user()')
Signed-off-by: Dan Carpenter 
---
The memdup_user() patch was never sent to the list so Greg gets ten
lashes with a wet noodle for missing this bug.

Also this is a typical one err bug except for the worse than usual label
name.  Using "one err" style error handling was supposed to prevent bugs
from being introduced in the future but instead it caused a future bug.

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c 
b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 42fba3f..cb0b63877 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -1900,23 +1900,20 @@ static int r871x_mp_ioctl_hdl(struct net_device *dev,
struct mp_ioctl_handler *phandler;
struct mp_ioctl_param *poidparam;
unsigned long BytesRead, BytesWritten, BytesNeeded;
-   u8 *pparmbuf = NULL, bset;
+   u8 *pparmbuf, bset;
u16 len;
uint status;
int ret = 0;
 
-   if ((!p->length) || (!p->pointer)) {
-   ret = -EINVAL;
-   goto _r871x_mp_ioctl_hdl_exit;
-   }
+   if ((!p->length) || (!p->pointer))
+   return -EINVAL;
+
bset = (u8)(p->flags & 0x);
len = p->length;
-   pparmbuf = NULL;
pparmbuf = memdup_user(p->pointer, len);
-   if (IS_ERR(pparmbuf)) {
-   ret = PTR_ERR(pparmbuf);
-   goto _r871x_mp_ioctl_hdl_exit;
-   }
+   if (IS_ERR(pparmbuf))
+   return PTR_ERR(pparmbuf);
+
poidparam = (struct mp_ioctl_param *)pparmbuf;
if (poidparam->subcode >= MAX_MP_IOCTL_SUBCODE) {
ret = -EINVAL;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/14] ALSA: portman2x4: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 sound/drivers/portman2x4.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index 464385a..866adbb 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -672,32 +672,37 @@ static int snd_portman_probe_port(struct parport *p)
return res ? -EIO : 0;
 }
 
-static void snd_portman_attach(struct parport *p)
+static int snd_portman_attach(struct parport *p)
 {
struct platform_device *device;
+   int ret;
 
device = platform_device_alloc(PLATFORM_DRIVER, device_count);
if (!device)
-   return;
+   return -ENOMEM;
 
/* Temporary assignment to forward the parport */
platform_set_drvdata(device, p);
 
-   if (platform_device_add(device) < 0) {
+   ret = platform_device_add(device);
+
+   if (ret < 0) {
platform_device_put(device);
-   return;
+   return ret;
}
 
/* Since we dont get the return value of probe
 * We need to check if device probing succeeded or not */
if (!platform_get_drvdata(device)) {
platform_device_unregister(device);
-   return;
+   return -ENODEV;
}
 
/* register device in global table */
platform_devices[device_count] = device;
device_count++;
+
+   return 0;
 }
 
 static void snd_portman_detach(struct parport *p)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/14] spi: butterfly: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 drivers/spi/spi-butterfly.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-butterfly.c b/drivers/spi/spi-butterfly.c
index 9a95862..7df16c8 100644
--- a/drivers/spi/spi-butterfly.c
+++ b/drivers/spi/spi-butterfly.c
@@ -190,7 +190,7 @@ static struct flash_platform_data flash = {
 /* REVISIT remove this ugly global and its "only one" limitation */
 static struct butterfly *butterfly;
 
-static void butterfly_attach(struct parport *p)
+static int butterfly_attach(struct parport *p)
 {
struct pardevice*pd;
int status;
@@ -199,7 +199,7 @@ static void butterfly_attach(struct parport *p)
struct device   *dev = p->physport->dev;
 
if (butterfly || !dev)
-   return;
+   return -ENODEV;
 
/* REVISIT:  this just _assumes_ a butterfly is there ... no probe,
 * and no way to be selective about what it binds to.
@@ -287,7 +287,7 @@ static void butterfly_attach(struct parport *p)
 
pr_info("%s: AVR Butterfly\n", p->name);
butterfly = pp;
-   return;
+   return 0;
 
 clean2:
/* turn off VCC */
@@ -300,6 +300,7 @@ clean0:
(void) spi_master_put(pp->bitbang.master);
 done:
pr_debug("%s: butterfly probe, fail %d\n", p->name, status);
+   return status;
 }
 
 static void butterfly_detach(struct parport *p)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/14] parport: check success of attach call

2015-04-08 Thread Sudip Mukherjee
Currently we are not checking if attach has succeeded or not. Also
parport_register_driver() always return 0 even if attach fails.
But in many places where attach has been used, it can fail.
So, modified the parport code to check the return value of attach and
accordingly return either 0 or error code from parport_register_driver.


Sudip Mukherjee (14):
  parport: return value of attach and parport_register_driver
  ALSA: portman2x4: return proper error values from attach
  ALSA: mts64: return proper error values from attach
  staging: panel: return proper error values from attach
  spi: lm70llp: return proper error values from attach
  spi: butterfly: return proper error values from attach
  [SCSI] ppa: return proper error values from attach
  [SCSI] imm: return proper error values from attach
  pps: return proper error values from attach
  pps: return proper error values from attach
  net: plip: return proper error values from attach
  i2c-parport: return proper error values from attach
  ppdev: return proper error values from attach
  char: lp: return proper error values from attach

 drivers/char/lp.c| 16 +++-
 drivers/char/ppdev.c | 10 +++---
 drivers/i2c/busses/i2c-parport.c |  7 ---
 drivers/net/plip/plip.c  | 16 ++--
 drivers/parport/share.c  | 20 +++-
 drivers/pps/clients/pps_parport.c|  7 ---
 drivers/pps/generators/pps_gen_parport.c |  9 +
 drivers/scsi/imm.c   |  4 ++--
 drivers/scsi/ppa.c   |  4 ++--
 drivers/spi/spi-butterfly.c  |  7 ---
 drivers/spi/spi-lm70llp.c|  7 ---
 drivers/staging/panel/panel.c| 11 ++-
 include/linux/parport.h  |  2 +-
 sound/drivers/mts64.c| 13 -
 sound/drivers/portman2x4.c   | 15 ++-
 15 files changed, 93 insertions(+), 55 deletions(-)

-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/14] ALSA: mts64: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 sound/drivers/mts64.c | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c
index 2a008a9..fb6223e 100644
--- a/sound/drivers/mts64.c
+++ b/sound/drivers/mts64.c
@@ -874,32 +874,35 @@ static int snd_mts64_probe_port(struct parport *p)
return res;
 }
 
-static void snd_mts64_attach(struct parport *p)
+static int snd_mts64_attach(struct parport *p)
 {
struct platform_device *device;
+   int ret;
 
device = platform_device_alloc(PLATFORM_DRIVER, device_count);
if (!device)
-   return;
+   return -ENOMEM;
 
/* Temporary assignment to forward the parport */
platform_set_drvdata(device, p);
 
-   if (platform_device_add(device) < 0) {
+   ret = platform_device_add(device);
+   if (ret < 0) {
platform_device_put(device);
-   return;
+   return ret;
}
 
/* Since we dont get the return value of probe
 * We need to check if device probing succeeded or not */
if (!platform_get_drvdata(device)) {
platform_device_unregister(device);
-   return;
+   return -ENODEV;
}
 
/* register device in global table */
platform_devices[device_count] = device;
device_count++;
+   return 0;
 }
 
 static void snd_mts64_detach(struct parport *p)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/14] staging: panel: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 drivers/staging/panel/panel.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index ea54fb4..61f6961 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -2188,15 +2188,15 @@ static struct notifier_block panel_notifier = {
0
 };
 
-static void panel_attach(struct parport *port)
+static int panel_attach(struct parport *port)
 {
if (port->number != parport)
-   return;
+   return -ENODEV;
 
if (pprt) {
pr_err("%s: port->number=%d parport=%d, already registered!\n",
   __func__, port->number, parport);
-   return;
+   return -EALREADY;
}
 
pprt = parport_register_device(port, "panel", NULL, NULL,  /* pf, kf */
@@ -2206,7 +2206,7 @@ static void panel_attach(struct parport *port)
if (pprt == NULL) {
pr_err("%s: port->number=%d parport=%d, 
parport_register_device() failed\n",
   __func__, port->number, parport);
-   return;
+   return -ENODEV;
}
 
if (parport_claim(pprt)) {
@@ -2230,7 +2230,7 @@ static void panel_attach(struct parport *port)
goto err_lcd_unreg;
}
register_reboot_notifier(&panel_notifier);
-   return;
+   return 0;
 
 err_lcd_unreg:
if (lcd.enabled)
@@ -2238,6 +2238,7 @@ err_lcd_unreg:
 err_unreg_device:
parport_unregister_device(pprt);
pprt = NULL;
+   return -ENODEV;
 }
 
 static void panel_detach(struct parport *port)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/14] [SCSI] imm: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 drivers/scsi/imm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c
index 89a8266..e26330a 100644
--- a/drivers/scsi/imm.c
+++ b/drivers/scsi/imm.c
@@ -1225,9 +1225,9 @@ out:
return err;
 }
 
-static void imm_attach(struct parport *pb)
+static int imm_attach(struct parport *pb)
 {
-   __imm_attach(pb);
+   return __imm_attach(pb);
 }
 
 static void imm_detach(struct parport *pb)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/14] parport: return value of attach and parport_register_driver

2015-04-08 Thread Sudip Mukherjee
as of now, we are not checking if attach or parport_register_driver
has succeeded or failed. But attach can fail in the places where they
have been used. Lets check the return of attach, and if attach fails
then parport_register_driver should also fail. We can have multiple
parallel port so we only mark attach as failed only if it has never
returned a 0.

Signed-off-by: Sudip Mukherjee 
---
 drivers/parport/share.c | 20 +++-
 include/linux/parport.h |  2 +-
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index 3fa6624..640ce41 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -148,23 +148,33 @@ static void get_lowlevel_driver (void)
  * callback, but if the driver wants to take a copy of the
  * pointer it must call parport_get_port() to do so.
  *
- * Returns 0 on success.  Currently it always succeeds.
+ * Returns 0 on success.
  **/
 
 int parport_register_driver (struct parport_driver *drv)
 {
struct parport *port;
+   int ret, err;
+   bool attached = false;
 
if (list_empty(&portlist))
get_lowlevel_driver ();
 
mutex_lock(®istration_lock);
-   list_for_each_entry(port, &portlist, list)
-   drv->attach(port);
-   list_add(&drv->list, &drivers);
+   list_for_each_entry(port, &portlist, list) {
+   err = drv->attach(port);
+   if (err == 0)
+   attached = true;
+   else
+   ret = err;
+   }
+   if (attached) {
+   list_add(&drv->list, &drivers);
+   ret = 0;
+   }
mutex_unlock(®istration_lock);
 
-   return 0;
+   return ret;
 }
 
 /**
diff --git a/include/linux/parport.h b/include/linux/parport.h
index c22f125..9411065 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -249,7 +249,7 @@ struct parport {
 
 struct parport_driver {
const char *name;
-   void (*attach) (struct parport *);
+   int (*attach)(struct parport *);
void (*detach) (struct parport *);
struct list_head list;
 };
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 07/14] [SCSI] ppa: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 drivers/scsi/ppa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c
index 1db8b26..48898ec 100644
--- a/drivers/scsi/ppa.c
+++ b/drivers/scsi/ppa.c
@@ -1090,9 +1090,9 @@ out:
return err;
 }
 
-static void ppa_attach(struct parport *pb)
+static int ppa_attach(struct parport *pb)
 {
-   __ppa_attach(pb);
+   return __ppa_attach(pb);
 }
 
 static void ppa_detach(struct parport *pb)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/14] net: plip: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.
also return the proper error code in module_init.

Signed-off-by: Sudip Mukherjee 
---
 drivers/net/plip/plip.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/plip/plip.c b/drivers/net/plip/plip.c
index 040b897..6706bc3 100644
--- a/drivers/net/plip/plip.c
+++ b/drivers/net/plip/plip.c
@@ -1243,7 +1243,7 @@ plip_searchfor(int list[], int a)
 
 /* plip_attach() is called (by the parport code) when a port is
  * available to use. */
-static void plip_attach (struct parport *port)
+static int plip_attach(struct parport *port)
 {
static int unit;
struct net_device *dev;
@@ -1254,13 +1254,13 @@ static void plip_attach (struct parport *port)
plip_searchfor(parport, port->number)) {
if (unit == PLIP_MAX) {
printk(KERN_ERR "plip: too many devices\n");
-   return;
+   return -EINVAL;
}
 
sprintf(name, "plip%d", unit);
dev = alloc_etherdev(sizeof(struct net_local));
if (!dev)
-   return;
+   return -ENOMEM;
 
strcpy(dev->name, name);
 
@@ -1300,12 +1300,13 @@ static void plip_attach (struct parport *port)
 dev->name, dev->base_addr);
dev_plip[unit++] = dev;
}
-   return;
+   return 0;
 
 err_parport_unregister:
parport_unregister_device(nl->pardev);
 err_free_dev:
free_netdev(dev);
+   return -ENODEV;
 }
 
 /* plip_detach() is called (by the parport code) when a port is
@@ -1379,6 +1380,8 @@ __setup("plip=", plip_setup);
 
 static int __init plip_init (void)
 {
+   int err;
+
if (parport[0] == -2)
return 0;
 
@@ -1387,9 +1390,10 @@ static int __init plip_init (void)
timid = 0;
}
 
-   if (parport_register_driver (&plip_driver)) {
+   err = parport_register_driver(&plip_driver);
+   if (err) {
printk (KERN_WARNING "plip: couldn't register driver\n");
-   return 1;
+   return err;
}
 
return 0;
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 09/14] pps: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 drivers/pps/generators/pps_gen_parport.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/pps/generators/pps_gen_parport.c 
b/drivers/pps/generators/pps_gen_parport.c
index dcd39fb..499f410 100644
--- a/drivers/pps/generators/pps_gen_parport.c
+++ b/drivers/pps/generators/pps_gen_parport.c
@@ -190,18 +190,18 @@ static inline ktime_t next_intr_time(struct 
pps_generator_pp *dev)
dev->port_write_time + 3 * SAFETY_INTERVAL));
 }
 
-static void parport_attach(struct parport *port)
+static int parport_attach(struct parport *port)
 {
if (attached) {
/* we already have a port */
-   return;
+   return -EALREADY;
}
 
device.pardev = parport_register_device(port, KBUILD_MODNAME,
NULL, NULL, NULL, PARPORT_FLAG_EXCL, &device);
if (!device.pardev) {
pr_err("couldn't register with %s\n", port->name);
-   return;
+   return -ENODEV;
}
 
if (parport_claim_or_block(device.pardev) < 0) {
@@ -218,10 +218,11 @@ static void parport_attach(struct parport *port)
device.timer.function = hrtimer_event;
hrtimer_start(&device.timer, next_intr_time(&device), HRTIMER_MODE_ABS);
 
-   return;
+   return 0;
 
 err_unregister_dev:
parport_unregister_device(device.pardev);
+   return -ENODEV;
 }
 
 static void parport_detach(struct parport *port)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 05/14] spi: lm70llp: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 drivers/spi/spi-lm70llp.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/spi-lm70llp.c b/drivers/spi/spi-lm70llp.c
index ba72347..9b0fde1 100644
--- a/drivers/spi/spi-lm70llp.c
+++ b/drivers/spi/spi-lm70llp.c
@@ -190,7 +190,7 @@ static u32 lm70_txrx(struct spi_device *spi, unsigned 
nsecs, u32 word, u8 bits)
return bitbang_txrx_be_cpha0(spi, nsecs, 0, 0, word, bits);
 }
 
-static void spi_lm70llp_attach(struct parport *p)
+static int spi_lm70llp_attach(struct parport *p)
 {
struct pardevice*pd;
struct spi_lm70llp  *pp;
@@ -201,7 +201,7 @@ static void spi_lm70llp_attach(struct parport *p)
printk(KERN_WARNING
"%s: spi_lm70llp instance already loaded. Aborting.\n",
DRVNAME);
-   return;
+   return -EALREADY;
}
 
/* TODO:  this just _assumes_ a lm70 is there ... no probe;
@@ -281,7 +281,7 @@ static void spi_lm70llp_attach(struct parport *p)
pp->spidev_lm70->bits_per_word = 8;
 
lm70llp = pp;
-   return;
+   return 0;
 
 out_bitbang_stop:
spi_bitbang_stop(&pp->bitbang);
@@ -296,6 +296,7 @@ out_free_master:
(void) spi_master_put(master);
 out_fail:
pr_info("%s: spi_lm70llp probe fail, status %d\n", DRVNAME, status);
+   return status;
 }
 
 static void spi_lm70llp_detach(struct parport *p)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 12/14] i2c-parport: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 drivers/i2c/busses/i2c-parport.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-parport.c b/drivers/i2c/busses/i2c-parport.c
index a1fac5a..761a775 100644
--- a/drivers/i2c/busses/i2c-parport.c
+++ b/drivers/i2c/busses/i2c-parport.c
@@ -160,14 +160,14 @@ static void i2c_parport_irq(void *data)
"SMBus alert received but no ARA client!\n");
 }
 
-static void i2c_parport_attach(struct parport *port)
+static int i2c_parport_attach(struct parport *port)
 {
struct i2c_par *adapter;
 
adapter = kzalloc(sizeof(struct i2c_par), GFP_KERNEL);
if (adapter == NULL) {
printk(KERN_ERR "i2c-parport: Failed to kzalloc\n");
-   return;
+   return -ENOMEM;
}
 
pr_debug("i2c-parport: attaching to %s\n", port->name);
@@ -230,13 +230,14 @@ static void i2c_parport_attach(struct parport *port)
mutex_lock(&adapter_list_lock);
list_add_tail(&adapter->node, &adapter_list);
mutex_unlock(&adapter_list_lock);
-   return;
+   return 0;
 
  err_unregister:
parport_release(adapter->pdev);
parport_unregister_device(adapter->pdev);
  err_free:
kfree(adapter);
+   return -ENODEV;
 }
 
 static void i2c_parport_detach(struct parport *port)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/14] pps: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 drivers/pps/clients/pps_parport.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pps/clients/pps_parport.c 
b/drivers/pps/clients/pps_parport.c
index 38a8bbe..a411621 100644
--- a/drivers/pps/clients/pps_parport.c
+++ b/drivers/pps/clients/pps_parport.c
@@ -134,7 +134,7 @@ out_both:
return;
 }
 
-static void parport_attach(struct parport *port)
+static int parport_attach(struct parport *port)
 {
struct pps_client_pp *device;
struct pps_source_info info = {
@@ -151,7 +151,7 @@ static void parport_attach(struct parport *port)
device = kzalloc(sizeof(struct pps_client_pp), GFP_KERNEL);
if (!device) {
pr_err("memory allocation failed, not attaching\n");
-   return;
+   return -ENOMEM;
}
 
device->pardev = parport_register_device(port, KBUILD_MODNAME,
@@ -179,7 +179,7 @@ static void parport_attach(struct parport *port)
 
pr_info("attached to %s\n", port->name);
 
-   return;
+   return 0;
 
 err_release_dev:
parport_release(device->pardev);
@@ -187,6 +187,7 @@ err_unregister_dev:
parport_unregister_device(device->pardev);
 err_free:
kfree(device);
+   return -ENODEV;
 }
 
 static void parport_detach(struct parport *port)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 14/14] char: lp: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 drivers/char/lp.c | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index c4094c4..6988480 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -900,34 +900,40 @@ static int lp_register(int nr, struct parport *port)
return 0;
 }
 
-static void lp_attach (struct parport *port)
+static int lp_attach(struct parport *port)
 {
unsigned int i;
+   int ret = -ENODEV;
 
switch (parport_nr[0]) {
case LP_PARPORT_UNSPEC:
case LP_PARPORT_AUTO:
if (parport_nr[0] == LP_PARPORT_AUTO &&
port->probe_info[0].class != PARPORT_CLASS_PRINTER)
-   return;
+   return ret;
if (lp_count == LP_NO) {
printk(KERN_INFO "lp: ignoring parallel port (max. 
%d)\n",LP_NO);
-   return;
+   return ret;
}
-   if (!lp_register(lp_count, port))
+   if (!lp_register(lp_count, port)) {
lp_count++;
+   ret = 0;
+   }
break;
 
default:
for (i = 0; i < LP_NO; i++) {
if (port->number == parport_nr[i]) {
-   if (!lp_register(i, port))
+   if (!lp_register(i, port)) {
lp_count++;
+   ret = 0;
+   }
break;
}
}
break;
}
+   return ret;
 }
 
 static void lp_detach (struct parport *port)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 13/14] ppdev: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
now that we are monitoring the return value from attach, make the
required changes to return proper value from its attach function.

Signed-off-by: Sudip Mukherjee 
---
 drivers/char/ppdev.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
index ae0b42b..14374d7 100644
--- a/drivers/char/ppdev.c
+++ b/drivers/char/ppdev.c
@@ -748,10 +748,14 @@ static const struct file_operations pp_fops = {
.release= pp_release,
 };
 
-static void pp_attach(struct parport *port)
+static int pp_attach(struct parport *port)
 {
-   device_create(ppdev_class, port->dev, MKDEV(PP_MAJOR, port->number),
- NULL, "parport%d", port->number);
+   struct device *dev;
+
+   dev = device_create(ppdev_class, port->dev,
+   MKDEV(PP_MAJOR, port->number), NULL,
+   "parport%d", port->number);
+   return PTR_ERR_OR_ZERO(dev);
 }
 
 static void pp_detach(struct parport *port)
-- 
1.8.1.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/14] parport: return value of attach and parport_register_driver

2015-04-08 Thread Dan Carpenter
1) We can't apply this patch on its own so this way of breaking up the
patches doesn't work.

2) I was thinking that all the ->attach() calls would have to succeed or
we would bail.  Having some of them succeed and some fail doesn't seem
like it will simplify the driver code very much.  But I can also see
your point.  Hm...

Minor comment:  No need to preserve the error code if there are lots
which we miss.  We may as well hard code an error code.  But that's a
minor thing.  Does this actually simplify the driver code?  That's the
more important thing.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/14] parport: return value of attach and parport_register_driver

2015-04-08 Thread Dan Carpenter
On Wed, Apr 08, 2015 at 02:38:32PM +0300, Dan Carpenter wrote:
> 1) We can't apply this patch on its own so this way of breaking up the
> patches doesn't work.
> 

The right thing is to do add an attach_ret().

static int do_attach(drv)
{
if (drv->attach_ret)
return drv->attach_ret();
drv->attach();
return 0;
}

Then we convert one driver to use the new function pointer and see if
it simplifies the code.  If so we can transition the others as well.  If
not then we give up.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/14] parport: return value of attach and parport_register_driver

2015-04-08 Thread Sudip Mukherjee
On Wed, Apr 08, 2015 at 02:38:32PM +0300, Dan Carpenter wrote:
> 1) We can't apply this patch on its own so this way of breaking up the
> patches doesn't work.
yes, if the first patch is reverted for any reason all the others need
to be reverted also. so then everything in one single patch?
> 
> 2) I was thinking that all the ->attach() calls would have to succeed or
> we would bail.  Having some of them succeed and some fail doesn't seem
> like it will simplify the driver code very much.  But I can also see
> your point.  Hm...
to clarify my point more here: any system might have more than one
parallel port but the module might decide to use just one. so in that
case attach will return 0 for the port that it wishes to use, for others
it will be a error code. So in parport_register_driver if we get error
codes in all the attach calls then we know that attach has definitely
failed, but atleast one 0 means one attach call has succeeded, which
will happen in case of staging/panel, net/plip...

> 
> Minor comment:  No need to preserve the error code if there are lots
> which we miss.  We may as well hard code an error code.  But that's a
> minor thing.  Does this actually simplify the driver code?  That's the
> more important thing.

i don't think this will simplify the driver code, but atleast now
parport_register_driver() will not report success when we have actually
failed. And as a result module_init will also fail which is supposed to
be the actual behviour.

regards
sudip

> 
> regards,
> dan carpenter
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/14] parport: return value of attach and parport_register_driver

2015-04-08 Thread Sudip Mukherjee
On Wed, Apr 08, 2015 at 02:44:37PM +0300, Dan Carpenter wrote:
> On Wed, Apr 08, 2015 at 02:38:32PM +0300, Dan Carpenter wrote:
> 
> Then we convert one driver to use the new function pointer and see if
> it simplifies the code.  If so we can transition the others as well.  If
> not then we give up.
i am sending a v2 and also a patch to change one driver.

regards
sudip
> 
> regards,
> dan carpenter
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/14] parport: return value of attach and parport_register_driver

2015-04-08 Thread Dan Carpenter
On Wed, Apr 08, 2015 at 05:20:10PM +0530, Sudip Mukherjee wrote:
> On Wed, Apr 08, 2015 at 02:38:32PM +0300, Dan Carpenter wrote:
> > 1) We can't apply this patch on its own so this way of breaking up the
> > patches doesn't work.
> yes, if the first patch is reverted for any reason all the others need
> to be reverted also. so then everything in one single patch?

The problem is that patch 1/1 breaks the build.  The rule is that we
should be able to apply part of a patch series and nothing breaks.  If
we apply the patch series out of order than things break that's our
problem, yes.  But if we apply only 1/1 and it breaks, that's a problem
with the series.

> > 
> > 2) I was thinking that all the ->attach() calls would have to succeed or
> > we would bail.  Having some of them succeed and some fail doesn't seem
> > like it will simplify the driver code very much.  But I can also see
> > your point.  Hm...

My other issue with this patch series which is related to #2 is that
it's not clear that anyone is checking the return value and doing
correct things with it.

Hopefully, when we use the attach_ret() approach then it will be more
clear if/how the return value is useful.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] media: cxd2099: move pre-init values out of init()

2015-04-08 Thread Luis de Bethencourt
On Wed, Apr 08, 2015 at 08:09:03AM -0300, Mauro Carvalho Chehab wrote:
> Em Sun, 8 Feb 2015 20:55:36 +
> luisbg  escreveu:
> 
> > Improve code readability by moving out all pre-init values from the init
> > function.
> > 
> > Signed-off-by: Luis de Bethencourt 
> > ---
> >  drivers/staging/media/cxd2099/cxd2099.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/media/cxd2099/cxd2099.c 
> > b/drivers/staging/media/cxd2099/cxd2099.c
> > index 657ea48..bafe36f 100644
> > --- a/drivers/staging/media/cxd2099/cxd2099.c
> > +++ b/drivers/staging/media/cxd2099/cxd2099.c
> > @@ -300,7 +300,6 @@ static int init(struct cxd *ci)
> > int status;
> >  
> > mutex_lock(&ci->lock);
> > -   ci->mode = -1;
> > do {
> > status = write_reg(ci, 0x00, 0x00);
> > if (status < 0)
> > @@ -420,7 +419,6 @@ static int init(struct cxd *ci)
> > status = write_regm(ci, 0x09, 0x08, 0x08);
> > if (status < 0)
> > break;
> > -   ci->cammode = -1;
> > cam_mode(ci, 0);
> > } while (0);
> > mutex_unlock(&ci->lock);
> > @@ -711,6 +709,8 @@ struct dvb_ca_en50221 *cxd2099_attach(struct 
> > cxd2099_cfg *cfg,
> >  
> > ci->en = en_templ;
> > ci->en.data = ci;
> > +   ci->mode = -1;
> > +   ci->cammode = -1;
> 
> This actually changes the logic, as, cammode is == -1 only if the
> do {} while loop succeeds.
> 
> Also, calling cam_mode(ci, 0) will change cammode to 0. Btw, for
> it to work, ci->mode should be initialized earlier.
> 
> So, this patch looks very wrong on my eyes, except if you found
> a real bug on it.
> 
> Have you tested it on a real device? What bug does it fix?
> 
> Regards,
> Mauro
> 

Apologies. You are right and this patch is completely wrong.

I submitted this while reading the code of a few drivers to learn from them.
I should've retracted it before you spent time reviewing it. Sorry for that.

Thanks,
Luis

> > init(ci);
> > dev_info(&i2c->dev, "Attached CXD2099AR at %02x\n", ci->cfg.adr);
> > return &ci->en;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: dgnc: remove some dead code from dgnc_tty.c

2015-04-08 Thread Giedrius Statkevičius
Remove some dead code that will never be executed or which serves no purpose

Signed-off-by: Giedrius Statkevičius 
---
 drivers/staging/dgnc/dgnc_tty.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index ce4187f..f954228 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -428,9 +428,6 @@ void dgnc_tty_uninit(struct dgnc_board *brd)
brd->PrintDriver.ttys = NULL;
 }
 
-
-#define TMPBUFLEN (1024)
-
 /*===
  *
  * dgnc_wmove - Write data to transmit queue.
@@ -555,15 +552,6 @@ void dgnc_input(struct channel_t *ch)
 
ld = tty_ldisc_ref(tp);
 
-#ifdef TTY_DONT_FLIP
-   /*
-* If the DONT_FLIP flag is on, don't flush our buffer, and act
-* like the ld doesn't have any space to put the data right now.
-*/
-   if (test_bit(TTY_DONT_FLIP, &tp->flags))
-   len = 0;
-#endif
-
/*
 * If we were unable to get a reference to the ld,
 * don't flush our buffer, and act like the ld doesn't
@@ -897,10 +885,6 @@ void dgnc_check_queue_flow_control(struct channel_t *ch)
ch->ch_stops_sent = 0;
ch->ch_bd->bd_ops->send_start_character(ch);
}
-   /* No FLOW */
-   else {
-   /* Nothing needed. */
-   }
}
 }
 
-- 
2.3.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 02/14] ALSA: portman2x4: return proper error values from attach

2015-04-08 Thread Sergei Shtylyov

Hello.

On 4/8/2015 2:20 PM, Sudip Mukherjee wrote:


now that we are monitoring the return value from attach, make the


   So you've first changed the method prototype and follow up with the 
changes to the actual implementations? That's backward. I'm afraid such 
changes can't be done piecemeal.



required changes to return proper value from its attach function.



Signed-off-by: Sudip Mukherjee 
---
  sound/drivers/portman2x4.c | 15 ++-
  1 file changed, 10 insertions(+), 5 deletions(-)



diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index 464385a..866adbb 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -672,32 +672,37 @@ static int snd_portman_probe_port(struct parport *p)
return res ? -EIO : 0;
  }

-static void snd_portman_attach(struct parport *p)
+static int snd_portman_attach(struct parport *p)
  {
struct platform_device *device;
+   int ret;

device = platform_device_alloc(PLATFORM_DRIVER, device_count);
if (!device)
-   return;
+   return -ENOMEM;

/* Temporary assignment to forward the parport */
platform_set_drvdata(device, p);

-   if (platform_device_add(device) < 0) {
+   ret = platform_device_add(device);
+


   I don't think empty line is needed here.


+   if (ret < 0) {
platform_device_put(device);
-   return;
+   return ret;
}


[...]

WBR, Sergei

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 02/14] ALSA: portman2x4: return proper error values from attach

2015-04-08 Thread Sudip Mukherjee
On Wed, Apr 08, 2015 at 04:32:57PM +0300, Sergei Shtylyov wrote:
> Hello.
> 
> On 4/8/2015 2:20 PM, Sudip Mukherjee wrote:
> 
> >now that we are monitoring the return value from attach, make the
> 
>So you've first changed the method prototype and follow up with
> the changes to the actual implementations? That's backward. I'm
> afraid such changes can't be done piecemeal.
Dan Carpenter has exlained me the problem with this aproach. I have
already sent a v2 which doesnot break anything and if everyone approves
that way then we can change one driver at a time and nothing will
break.

regards
sudip

> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] hv_netvsc: try linearizing big SKBs before dropping them

2015-04-08 Thread Vitaly Kuznetsov
In netvsc_start_xmit() we can handle packets which are scattered around not
more than MAX_PAGE_BUFFER_COUNT-2 pages. It is, however, easy to create a
packet which is not big in size but occupies more pages (e.g. if it uses frags
on compound pages boundaries). When we drop such packet it cases sender to try
resending it but in most cases it will try resending the same packet which will
also get dropped, this will cause the particular connection to stick. To solve
the issue we can try linearizing skb.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/net/hyperv/netvsc_drv.c | 25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 9e4230d..4487167 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -377,27 +377,42 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct 
net_device *net)
struct rndis_packet *rndis_pkt;
u32 rndis_msg_size;
bool isvlan;
+   bool linear = false;
struct rndis_per_packet_info *ppi;
struct ndis_tcp_ip_checksum_info *csum_info;
struct ndis_tcp_lso_info *lso_info;
int  hdr_offset;
u32 net_trans_info;
u32 hash;
-   u32 skb_length = skb->len;
-   u32 head_room = skb_headroom(skb);
+   u32 skb_length;
+   u32 head_room;
u32 pkt_sz;
struct hv_page_buffer page_buf[MAX_PAGE_BUFFER_COUNT];
 
 
/* We will atmost need two pages to describe the rndis
 * header. We can only transmit MAX_PAGE_BUFFER_COUNT number
-* of pages in a single packet.
+* of pages in a single packet. If skb is scattered around
+* more pages we try linearizing it.
 */
+
+check_size:
+   skb_length = skb->len;
+   head_room = skb_headroom(skb);
num_data_pgs = netvsc_get_slots(skb) + 2;
-   if (num_data_pgs > MAX_PAGE_BUFFER_COUNT) {
-   netdev_err(net, "Packet too big: %u\n", skb->len);
+   if (num_data_pgs > MAX_PAGE_BUFFER_COUNT && linear) {
+   net_alert_ratelimited("packet too big: %u pages (%u bytes)\n",
+ num_data_pgs, skb->len);
ret = -EFAULT;
goto drop;
+   } else if (num_data_pgs > MAX_PAGE_BUFFER_COUNT) {
+   if (skb_linearize(skb)) {
+   net_alert_ratelimited("failed to linearize skb\n");
+   ret = -ENOMEM;
+   goto drop;
+   }
+   linear = true;
+   goto check_size;
}
 
pkt_sz = sizeof(struct hv_netvsc_packet) + RNDIS_AND_PPI_SIZE;
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/2] hv_netvsc: linearize SKBs bigger than MAX_PAGE_BUFFER_COUNT-2 pages

2015-04-08 Thread Vitaly Kuznetsov
This patch series fixes the same issue which was fixed in Xen with commit
97a6d1bb2b658ac85ed88205ccd1ab809899884d ("xen-netfront: Fix handling packets on
compound pages with skb_linearize").

It is relatively easy to create a packet which is small in size but occupies
more than 30 (MAX_PAGE_BUFFER_COUNT-2) pages. Here is a kernel-mode reproducer
which tries sending a packet with only 34 bytes of payload (but on 34 pages)
and fails:

#include 
#include 
#include 
#include 
#include 

static int __init sendfb_init(void)
{
struct socket *sock;
int i, ret;
struct sockaddr_in in4_addr = { 0 };
struct page *pages[17];
unsigned long flags;

ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock);
if (ret) {
pr_err("failed to create socket: %d!\n", ret);
return ret;
}

in4_addr.sin_family = AF_INET;
/* www.google.com, 74.125.133.99 */
in4_addr.sin_addr.s_addr = cpu_to_be32(0x4a7d8563);
in4_addr.sin_port = cpu_to_be16(80);

ret = sock->ops->connect(sock, (struct sockaddr *)&in4_addr, 
sizeof(in4_addr), 0);
if (ret) {
pr_err("failed to connect: %d!\n", ret);
return ret;
}

/* We can send up to 17 frags */
flags = MSG_MORE;
for (i = 0; i < 17; i++) {
if (i == 16)
flags = MSG_EOR;
pages[i] = alloc_pages(GFP_KERNEL | __GFP_COMP, 1);
if (!pages[i]) {
pr_err("out of memory!");
goto free_pages;
}
sock->ops->sendpage(sock, pages[i], PAGE_SIZE -1, 2, flags);
}

free_pages:
for (; i > 0; i--)
__free_pages(pages[i - 1], 1);

printk("sendfb_init: test done\n");
return -1;
}

module_init(sendfb_init);

MODULE_LICENSE("GPL");

A try to load such module results in multiple
'kernel: hv_netvsc vmbus_15 eth0: Packet too big: 100' messages as all retries
fail as well. It should also be possible to trigger the issue from userspace, I
expect e.g. NFS under heavy load to get stuck sometimes.

Vitaly Kuznetsov (2):
  hv_netvsc: use single existing drop path in netvsc_start_xmit
  hv_netvsc: try linearizing big SKBs before dropping them

 drivers/net/hyperv/netvsc_drv.c | 39 ++-
 1 file changed, 26 insertions(+), 13 deletions(-)

-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] hv_netvsc: use single existing drop path in netvsc_start_xmit

2015-04-08 Thread Vitaly Kuznetsov
... which validly uses dev_kfree_skb_any() instead of dev_kfree_skb().

Setting ret to -EFAULT and -ENOMEM have no real meaning here (we need to set
it to anything but -EAGAIN) as we drop the packet and return NETDEV_TX_OK
anyway.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/net/hyperv/netvsc_drv.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index e5fa094..9e4230d 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -370,7 +370,7 @@ not_ip:
 static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
 {
struct net_device_context *net_device_ctx = netdev_priv(net);
-   struct hv_netvsc_packet *packet;
+   struct hv_netvsc_packet *packet = NULL;
int ret;
unsigned int num_data_pgs;
struct rndis_message *rndis_msg;
@@ -396,9 +396,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct 
net_device *net)
num_data_pgs = netvsc_get_slots(skb) + 2;
if (num_data_pgs > MAX_PAGE_BUFFER_COUNT) {
netdev_err(net, "Packet too big: %u\n", skb->len);
-   dev_kfree_skb(skb);
-   net->stats.tx_dropped++;
-   return NETDEV_TX_OK;
+   ret = -EFAULT;
+   goto drop;
}
 
pkt_sz = sizeof(struct hv_netvsc_packet) + RNDIS_AND_PPI_SIZE;
@@ -408,9 +407,8 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct 
net_device *net)
if (!packet) {
/* out of memory, drop packet */
netdev_err(net, "unable to alloc hv_netvsc_packet\n");
-   dev_kfree_skb(skb);
-   net->stats.tx_dropped++;
-   return NETDEV_TX_OK;
+   ret = -ENOMEM;
+   goto drop;
}
packet->part_of_skb = false;
} else {
@@ -574,7 +572,7 @@ drop:
net->stats.tx_bytes += skb_length;
net->stats.tx_packets++;
} else {
-   if (!packet->part_of_skb)
+   if (packet && !packet->part_of_skb)
kfree(packet);
if (ret != -EAGAIN) {
dev_kfree_skb_any(skb);
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RFCv2 00/21] Drivers: hv: utils: re-implement the kernel/userspace communication layer

2015-04-08 Thread Vitaly Kuznetsov
KY Srinivasan  writes:

>> -Original Message-
>> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
>> Sent: Wednesday, March 11, 2015 6:29 AM
>> To: KY Srinivasan; de...@linuxdriverproject.org
>> Cc: Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui; Radim Krcmar;
>> Greg Kroah-Hartman; linux-...@vger.kernel.org
>> Subject: [PATCH RFCv2 00/21] Drivers: hv: utils: re-implement the
>> kernel/userspace communication layer
>> 
>> Changes in RFCv2:
>> - Preserve backwards compatibility with netlink-speaking daemons. [K. Y.
>> Srinivasan]
>> - Introduce transport abstraction layer. [K. Y. Srinivasan]
>> - Get rid of ioctls [Radim Krcmar]
>> - Make the series reviewable by splitting it into smaller patches.
>> 
>> Anatomy of the series:
>> Patches 01 - 07 are cleanup with minor functional change.
>> Patch 08 defines the state machine.
>> Patches 09-11 convert all 3 drivers to using the state machine.
>> Patch 12 fixes a bug in fcopy. This change is going away in Patch 15,  I just
>> want to highlight the fix.
>> Patch 13 introduces a transport abstraction.
>> Patch 14-16 convert all drivers to using the transport abstraction.
>> Patches 17-18 switch KVP and VSS daemon to using char devices.
>> Patches 19-20 convert FCOPY and VSS to hull handshake (the same we have
>> in  KVP). These two can be postponed till we really need to distinguish
>> between  different kernels in the daemon code.
>> Patch 21 unifies log messages on daemons connect across all drivers and
>> moves  these messages to debug level.
>> 
>> I smoke-tested this series with both old (netlink) and new (char devices)
>> daemons and tested the daemon upgrade procedure.
>> 
>> Original description:
>> This series converts kvp/vss daemons to use misc char devices instead of
>> netlink for userspace/kernel communication and then updates fcopy to be
>> consistent with kvp/vss.
>> 
>> Userspace/kernel communication via netlink has a number of issues:
>> - It is hard for userspace to figure out if the kernel part was loaded or not
>>   and this fact can change as there is a way to enable/disable the service 
>> from
>>   host side. Racy daemon startup is also a problem.
>> - When the userspace daemon restarts/dies kernel part doesn't receive a
>>   notification.
>> - Netlink communication is not stable under heavy load.
>> - ...
>> 
>> Vitaly Kuznetsov (21):
>>   Drivers: hv: util: move kvp/vss function declarations to
>> hyperv_vmbus.h
>>   Drivers: hv: kvp: reset kvp_context
>>   Drivers: hv: kvp: move poll_channel() to hyperv_vmbus.h
>>   Drivers: hv: fcopy: process deferred messages when we complete the
>> transaction
>>   Drivers: hv: vss: process deferred messages when we complete the
>> transaction
>>   Drivers: hv: kvp: rename kvp_work -> kvp_timeout_work
>>   Drivers: hv: fcopy: rename fcopy_work -> fcopy_timeout_work
>>   Drivers: hv: util: introduce state machine for util drivers
>>   Drivers: hv: kvp: switch to using the hvutil_device_state state
>> machine
>>   Drivers: hv: vss: switch to using the hvutil_device_state state
>> machine
>>   Drivers: hv: fcopy: switch to using the hvutil_device_state state
>> machine
>>   Drivers: hv: fcopy: set .owner reference for file operations
>>   Drivers: hv: util: introduce hv_utils_transport abstraction
>>   Drivers: hv: vss: convert to hv_utils_transport
>>   Drivers: hv: fcopy: convert to hv_utils_transport
>>   Drivers: hv: kvp: convert to hv_utils_transport
>>   Tools: hv: kvp: use misc char device to communicate with kernel
>>   Tools: hv: vss: use misc char device to communicate with kernel
>>   Drivers: hv: vss: full handshake support
>>   Drivers: hv: fcopy: full handshake support
>>   Drivers: hv: utils: unify driver registration reporting
>> 
>>  drivers/hv/Makefile |   2 +-
>>  drivers/hv/hv_fcopy.c   | 287 
>> ++--
>>  drivers/hv/hv_kvp.c | 192 +--
>>  drivers/hv/hv_snapshot.c| 168 +++
>>  drivers/hv/hv_utils_transport.c | 276
>> ++
>>  drivers/hv/hv_utils_transport.h |  51 +++
>>  drivers/hv/hyperv_vmbus.h   |  29 
>>  include/linux/hyperv.h  |   8 --
>>  include/uapi/linux/hyperv.h |   8 +-
>>  tools/hv/hv_fcopy_daemon.c  |  15 +++
>>  tools/hv/hv_kvp_daemon.c| 166 +--
>>  tools/hv/hv_vss_daemon.c| 149 ++---
>>  12 files changed, 752 insertions(+), 599 deletions(-)  create mode 100644
>> drivers/hv/hv_utils_transport.c  create mode 100644
>> drivers/hv/hv_utils_transport.h
>
> Vitaly,
>
> Thank you very much for taking on this project; very well done. I have mostly 
> reviewed the code and I should be
> done shortly. Also, I am going to test this code as well. If there are no 
> issues, I will send this out to Greg in my next 
> installment of patches.

Hi K.Y.,

I don't mean to rush or anything but please let me know i

RE: [PATCH RFCv2 00/21] Drivers: hv: utils: re-implement the kernel/userspace communication layer

2015-04-08 Thread KY Srinivasan


> -Original Message-
> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> Sent: Wednesday, April 8, 2015 9:01 AM
> To: KY Srinivasan
> Cc: de...@linuxdriverproject.org; Haiyang Zhang; linux-
> ker...@vger.kernel.org; Dexuan Cui; Radim Krcmar; Greg Kroah-Hartman;
> linux-...@vger.kernel.org
> Subject: Re: [PATCH RFCv2 00/21] Drivers: hv: utils: re-implement the
> kernel/userspace communication layer
> 
> KY Srinivasan  writes:
> 
> >> -Original Message-
> >> From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com]
> >> Sent: Wednesday, March 11, 2015 6:29 AM
> >> To: KY Srinivasan; de...@linuxdriverproject.org
> >> Cc: Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui; Radim
> Krcmar;
> >> Greg Kroah-Hartman; linux-...@vger.kernel.org
> >> Subject: [PATCH RFCv2 00/21] Drivers: hv: utils: re-implement the
> >> kernel/userspace communication layer
> >>
> >> Changes in RFCv2:
> >> - Preserve backwards compatibility with netlink-speaking daemons. [K. Y.
> >> Srinivasan]
> >> - Introduce transport abstraction layer. [K. Y. Srinivasan]
> >> - Get rid of ioctls [Radim Krcmar]
> >> - Make the series reviewable by splitting it into smaller patches.
> >>
> >> Anatomy of the series:
> >> Patches 01 - 07 are cleanup with minor functional change.
> >> Patch 08 defines the state machine.
> >> Patches 09-11 convert all 3 drivers to using the state machine.
> >> Patch 12 fixes a bug in fcopy. This change is going away in Patch 15,  I 
> >> just
> >> want to highlight the fix.
> >> Patch 13 introduces a transport abstraction.
> >> Patch 14-16 convert all drivers to using the transport abstraction.
> >> Patches 17-18 switch KVP and VSS daemon to using char devices.
> >> Patches 19-20 convert FCOPY and VSS to hull handshake (the same we
> have
> >> in  KVP). These two can be postponed till we really need to distinguish
> >> between  different kernels in the daemon code.
> >> Patch 21 unifies log messages on daemons connect across all drivers and
> >> moves  these messages to debug level.
> >>
> >> I smoke-tested this series with both old (netlink) and new (char devices)
> >> daemons and tested the daemon upgrade procedure.
> >>
> >> Original description:
> >> This series converts kvp/vss daemons to use misc char devices instead of
> >> netlink for userspace/kernel communication and then updates fcopy to
> be
> >> consistent with kvp/vss.
> >>
> >> Userspace/kernel communication via netlink has a number of issues:
> >> - It is hard for userspace to figure out if the kernel part was loaded or 
> >> not
> >>   and this fact can change as there is a way to enable/disable the service
> from
> >>   host side. Racy daemon startup is also a problem.
> >> - When the userspace daemon restarts/dies kernel part doesn't receive a
> >>   notification.
> >> - Netlink communication is not stable under heavy load.
> >> - ...
> >>
> >> Vitaly Kuznetsov (21):
> >>   Drivers: hv: util: move kvp/vss function declarations to
> >> hyperv_vmbus.h
> >>   Drivers: hv: kvp: reset kvp_context
> >>   Drivers: hv: kvp: move poll_channel() to hyperv_vmbus.h
> >>   Drivers: hv: fcopy: process deferred messages when we complete the
> >> transaction
> >>   Drivers: hv: vss: process deferred messages when we complete the
> >> transaction
> >>   Drivers: hv: kvp: rename kvp_work -> kvp_timeout_work
> >>   Drivers: hv: fcopy: rename fcopy_work -> fcopy_timeout_work
> >>   Drivers: hv: util: introduce state machine for util drivers
> >>   Drivers: hv: kvp: switch to using the hvutil_device_state state
> >> machine
> >>   Drivers: hv: vss: switch to using the hvutil_device_state state
> >> machine
> >>   Drivers: hv: fcopy: switch to using the hvutil_device_state state
> >> machine
> >>   Drivers: hv: fcopy: set .owner reference for file operations
> >>   Drivers: hv: util: introduce hv_utils_transport abstraction
> >>   Drivers: hv: vss: convert to hv_utils_transport
> >>   Drivers: hv: fcopy: convert to hv_utils_transport
> >>   Drivers: hv: kvp: convert to hv_utils_transport
> >>   Tools: hv: kvp: use misc char device to communicate with kernel
> >>   Tools: hv: vss: use misc char device to communicate with kernel
> >>   Drivers: hv: vss: full handshake support
> >>   Drivers: hv: fcopy: full handshake support
> >>   Drivers: hv: utils: unify driver registration reporting
> >>
> >>  drivers/hv/Makefile |   2 +-
> >>  drivers/hv/hv_fcopy.c   | 287 
> >> ++--
> >>  drivers/hv/hv_kvp.c | 192 +--
> >>  drivers/hv/hv_snapshot.c| 168 +++
> >>  drivers/hv/hv_utils_transport.c | 276
> >> ++
> >>  drivers/hv/hv_utils_transport.h |  51 +++
> >>  drivers/hv/hyperv_vmbus.h   |  29 
> >>  include/linux/hyperv.h  |   8 --
> >>  include/uapi/linux/hyperv.h |   8 +-
> >>  tools/hv/hv_fcopy_daemon.c  |  15 +++
> >>  tools/hv/hv_kvp_daemon.c| 16

Re: [PATCH 0/2] hv_netvsc: linearize SKBs bigger than MAX_PAGE_BUFFER_COUNT-2 pages

2015-04-08 Thread David Miller
From: Vitaly Kuznetsov 
Date: Wed,  8 Apr 2015 17:54:04 +0200

> This patch series fixes the same issue which was fixed in Xen with commit
> 97a6d1bb2b658ac85ed88205ccd1ab809899884d ("xen-netfront: Fix handling packets 
> on
> compound pages with skb_linearize").

This patch series only applies on net-next, so that's where I put it.

Please be completely explicit about this in the future, rather than
forcing me to try and figure it out.

Thanks.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/2] hv_netvsc: linearize SKBs bigger than MAX_PAGE_BUFFER_COUNT-2 pages

2015-04-08 Thread Vitaly Kuznetsov
David Miller  writes:

> From: Vitaly Kuznetsov 
> Date: Wed,  8 Apr 2015 17:54:04 +0200
>
>> This patch series fixes the same issue which was fixed in Xen with commit
>> 97a6d1bb2b658ac85ed88205ccd1ab809899884d ("xen-netfront: Fix handling 
>> packets on
>> compound pages with skb_linearize").
>
> This patch series only applies on net-next, so that's where I put it.

Yes, it is for net-next, thanks.

>
> Please be completely explicit about this in the future, rather than
> forcing me to try and figure it out.

Sorry, I will, for some reason I thought it was the default.

>
> Thanks.

-- 
  Vitaly
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: sm750fb: Remove space after parenthesis

2015-04-08 Thread Amitoj Kaur Chawla
Fixed error by removing space after open parenthesis '('
Problem found using checkpatch.pl
ERROR: space prohibited after that open parenthesis '('

Signed-off-by: Amitoj Kaur Chawla 
---
 drivers/staging/sm750fb/ddk750_chip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 7b28328..3cb860c 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -285,7 +285,7 @@ int ddk750_initHw(initchip_param_t *pInitParam)
ulReg = FIELD_SET(ulReg, VGA_CONFIGURATION, MODE, GRAPHIC);
POKE32(VGA_CONFIGURATION, ulReg);
} else {
-#if defined(__i386__) || defined( __x86_64__)
+#if defined(__i386__) || defined(__x86_64__)
/* set graphic mode via IO method */
outb_p(0x88, 0x3d4);
outb_p(0x06, 0x3d5);
@@ -382,7 +382,7 @@ int ddk750_initHw(initchip_param_t *pInitParam)
 
 unsigned int absDiff(unsigned int a, unsigned int b)
 {
-   if ( a > b )
+   if (a > b)
return(a - b);
else
return(b - a);
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V2 0/7] scsi: storvsc: Miscellaneous enhancements and fixes

2015-04-08 Thread James Bottomley
On Fri, 2015-03-27 at 00:26 -0700, K. Y. Srinivasan wrote:
> This patch-set addresses perf issues discovered on the Azure storage stack.
> These patches also fix a couple of bugs.
> 
> As in the first version of this patch-set, some of the patches are simply a 
> resend.
> I have bumped up the version number of all patches though. In this version, I 
> have
> addressed issues raised by Olaf Hering ,
> Long Li  and Venkatesh Srinivas 

Well, I was waiting for a reviewed-by from Olaf and Venkatesh, but I
guess that's not forthcoming.

James


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/14] parport: return value of attach and parport_register_driver

2015-04-08 Thread Willy Tarreau
On Wed, Apr 08, 2015 at 03:27:37PM +0300, Dan Carpenter wrote:
> On Wed, Apr 08, 2015 at 05:20:10PM +0530, Sudip Mukherjee wrote:
> > On Wed, Apr 08, 2015 at 02:38:32PM +0300, Dan Carpenter wrote:
> > > 1) We can't apply this patch on its own so this way of breaking up the
> > > patches doesn't work.
> > yes, if the first patch is reverted for any reason all the others need
> > to be reverted also. so then everything in one single patch?
> 
> The problem is that patch 1/1 breaks the build.  The rule is that we
> should be able to apply part of a patch series and nothing breaks.  If
> we apply the patch series out of order than things break that's our
> problem, yes.  But if we apply only 1/1 and it breaks, that's a problem
> with the series.

Yep, keep in mind that "git bisect" will randomly land in the middle of
any set of patches during a debugging session and it could very well land
on this one. If it breaks, that's a real pain for the people trying to
bisect their bug because suddenly they have to deal with a second bug
totally different from theirs.

Regards,
Willy

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: lustre: llite: remove obsolete conditional code

2015-04-08 Thread Andreas Dilger
Remove conditional flock/aops code that was only for out-of-tree
vendor kernels but is not relevant for in-kernel code.

Signed-off-by: Andreas Dilger 
---
 drivers/staging/lustre/lustre/llite/llite_internal.h |  4 
 drivers/staging/lustre/lustre/llite/llite_lib.c  |  8 
 drivers/staging/lustre/lustre/llite/rw26.c   | 20 
 3 files changed, 32 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 37306e0..1d4b2eb 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -727,11 +727,7 @@ int ll_readahead(const struct lu_env *env, struct cl_io 
*io,
 struct ll_readahead_state *ras, struct address_space *mapping,
 struct cl_page_list *queue, int flags);
 
-#ifndef MS_HAS_NEW_AOPS
 extern const struct address_space_operations ll_aops;
-#else
-extern const struct address_space_operations_ext ll_aops;
-#endif
 
 /* llite/file.c */
 extern struct file_operations ll_file_operations;
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index a3367bf..8327ad6 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -228,14 +228,6 @@ static int client_common_fill_super(struct super_block 
*sb, char *md, char *dt,
if (sbi->ll_flags & LL_SBI_USER_XATTR)
data->ocd_connect_flags |= OBD_CONNECT_XATTR;
 
-#ifdef HAVE_MS_FLOCK_LOCK
-   /* force vfs to use lustre handler for flock() calls - bug 10743 */
-   sb->s_flags |= MS_FLOCK_LOCK;
-#endif
-#ifdef MS_HAS_NEW_AOPS
-   sb->s_flags |= MS_HAS_NEW_AOPS;
-#endif
-
if (sbi->ll_flags & LL_SBI_FLOCK)
sbi->ll_fop = &ll_file_operations_flock;
else if (sbi->ll_flags & LL_SBI_LOCALFLOCK)
diff --git a/drivers/staging/lustre/lustre/llite/rw26.c 
b/drivers/staging/lustre/lustre/llite/rw26.c
index 2f21304..5d8bdfd 100644
--- a/drivers/staging/lustre/lustre/llite/rw26.c
+++ b/drivers/staging/lustre/lustre/llite/rw26.c
@@ -517,7 +517,6 @@ static int ll_migratepage(struct address_space *mapping,
 }
 #endif
 
-#ifndef MS_HAS_NEW_AOPS
 const struct address_space_operations ll_aops = {
.readpage   = ll_readpage,
.direct_IO  = ll_direct_IO_26,
@@ -532,22 +531,3 @@ const struct address_space_operations ll_aops = {
.migratepage= ll_migratepage,
 #endif
 };
-#else
-const struct address_space_operations_ext ll_aops = {
-   .orig_aops.readpage   = ll_readpage,
-/* .orig_aops.readpages  = ll_readpages, */
-   .orig_aops.direct_IO  = ll_direct_IO_26,
-   .orig_aops.writepage  = ll_writepage,
-   .orig_aops.writepages = ll_writepages,
-   .orig_aops.set_page_dirty = ll_set_page_dirty,
-   .orig_aops.prepare_write  = ll_prepare_write,
-   .orig_aops.commit_write   = ll_commit_write,
-   .orig_aops.invalidatepage = ll_invalidatepage,
-   .orig_aops.releasepage= ll_releasepage,
-#ifdef CONFIG_MIGRATION
-   .orig_aops.migratepage= ll_migratepage,
-#endif
-   .write_begin= ll_write_begin,
-   .write_end  = ll_write_end
-};
-#endif
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 6/6] staging: fsl-mc: Changed version matching rules for MC object drivers

2015-04-08 Thread Alexander Graf

On 03/27/2015 10:01 PM, J. German Rivera wrote:

Before this change, we were requiring a complete version match (major and
minor version numbers) between MC objects and corresponding drivers, to
allow MC objects to be bound to their drivers. We realized that a mismatch
in minor version numbers should be tolerated, as long as the major version
numbers match. This allows the driver to decide what to do in the minor
version mismatch case. For example, a driver may decide to run with
downgraded functionality if the MC firmware object has older minor version
number than the driver. Also, a driver with older minor version than the
MC firmware object may decide to run even though it cannot use newer
functionality of the MC object.

As part of this change, the dpmng Flib version was also updated
to match the latest MC firmware version.

Signed-off-by: J. German Rivera 


I think this is a step into the right direction, but you really don't 
want to match only when the minor equals. Usually you'd like something like


  if (cur_minor > max_minor) {
dev_warn("Unknown version %d.%d of fsl-mc detected. Please update 
your kernel if you encounter problems.")

  }

but always assume that cur_minor < max_minor works. In cases where the 
protocol did change between minors, add code to support the older minors 
as well.



Alex

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/6] staging: fsl-mc: cleanup and minor corrections

2015-04-08 Thread Alexander Graf

On 03/27/2015 10:01 PM, J. German Rivera wrote:

This patch series includes some cleanup/refactoring and minor correction
patches for the Freescale fsl-mc bus driver.

Patch 1: Name MC object devices using decimal numbers
Patch 2: Removed reordering of MC objects during bus scan
Patch 3: Bind/unbind driver when MC object is plugged/unplugged
Patch 4: Fix crash in fsl_mc_device_remove()
Patch 5: Refactored fsl_mc_object_allocator driver init/exit
Patch 6: Changed version matching rules for MC object drivers



Acked-by: Alexander Graf 


Alex

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] hv: vmbus_free_channels(): remove the redundant free_channel()

2015-04-08 Thread Dexuan Cui
free_channel() has been invoked in
vmbus_remove() -> hv_process_channel_removal(), or vmbus_remove() ->
... -> vmbus_close_internal() -> hv_process_channel_removal().

We also change to use list_for_each_entry_safe(), because the entry
is removed in hv_process_channel_removal().

Thank Dan Carpenter for finding the issue!

Signed-off-by: Dexuan Cui 
Reported-by: Dan Carpenter 
Cc: K. Y. Srinivasan 
Cc: Vitaly Kuznetsov 
---
 drivers/hv/channel_mgmt.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 0eeb1b3..865a3af 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -212,11 +212,16 @@ void hv_process_channel_removal(struct vmbus_channel 
*channel, u32 relid)
 
 void vmbus_free_channels(void)
 {
-   struct vmbus_channel *channel;
+   struct vmbus_channel *channel, *tmp;
+
+   list_for_each_entry_safe(channel, tmp, &vmbus_connection.chn_list,
+   listentry) {
+   /* if we don't set rescind to true, vmbus_close_internal()
+* won't invoke hv_process_channel_removal().
+*/
+   channel->rescind = true;
 
-   list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
vmbus_device_unregister(channel->device_obj);
-   free_channel(channel);
}
 }
 
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel