[PATCH] Staging: comedi: fix memory leak in comedi_bond.c

2014-02-07 Thread Chase Southwood
We allocate bdev and then krealloc the devs pointer in order to add bdev
at the end of the devpriv->devs array list.  But if for some reason this
krealloc fails, we need to free bdev before returning an error otherwise
this memory is leaked.

Signed-off-by: Chase Southwood 
---
 drivers/staging/comedi/drivers/comedi_bond.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/comedi/drivers/comedi_bond.c 
b/drivers/staging/comedi/drivers/comedi_bond.c
index 51a59e5..406aedb 100644
--- a/drivers/staging/comedi/drivers/comedi_bond.c
+++ b/drivers/staging/comedi/drivers/comedi_bond.c
@@ -254,6 +254,7 @@ static int do_dev_config(struct comedi_device *dev, struct 
comedi_devconfig *it)
if (!devs) {
dev_err(dev->class_dev,
"Could not allocate memory. Out of 
memory?\n");
+   kfree(bdev);
return -ENOMEM;
}
devpriv->devs = devs;
-- 
1.8.5.3

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


[PATCH 1/2] staging: android: binder: use whitespace consistently

2014-02-07 Thread SeongJae Park
Whitespace between #define keyword and BINDER_* constants are space in
some point and tab in some point. Using space or tab is just writer's
choice. But, let's use them more consistently.

Signed-off-by: SeongJae Park 
---
 drivers/staging/android/binder.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/android/binder.h b/drivers/staging/android/binder.h
index cbe34516..c4c1ed6 100644
--- a/drivers/staging/android/binder.h
+++ b/drivers/staging/android/binder.h
@@ -85,11 +85,11 @@ struct binder_version {
 #define BINDER_CURRENT_PROTOCOL_VERSION 7
 
 #define BINDER_WRITE_READ  _IOWR('b', 1, struct binder_write_read)
-#defineBINDER_SET_IDLE_TIMEOUT _IOW('b', 3, __s64)
-#defineBINDER_SET_MAX_THREADS  _IOW('b', 5, __u32)
-#defineBINDER_SET_IDLE_PRIORITY_IOW('b', 6, __s32)
-#defineBINDER_SET_CONTEXT_MGR  _IOW('b', 7, __s32)
-#defineBINDER_THREAD_EXIT  _IOW('b', 8, __s32)
+#define BINDER_SET_IDLE_TIMEOUT_IOW('b', 3, __s64)
+#define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
+#define BINDER_SET_IDLE_PRIORITY   _IOW('b', 6, __s32)
+#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32)
+#define BINDER_THREAD_EXIT _IOW('b', 8, __s32)
 #define BINDER_VERSION _IOWR('b', 9, struct binder_version)
 
 /*
-- 
1.8.1.2

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


[PATCH 2/2] staging: android: remove unused constant, BINDER_SET_IDLE_PRIORITY

2014-02-07 Thread SeongJae Park
Remove constant BINDER_SET_IDLE_PRIORITY because it is not used from
anywhere.

Signed-off-by: SeongJae Park 
---
 drivers/staging/android/binder.h | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/binder.h b/drivers/staging/android/binder.h
index c4c1ed6..6d08e61 100644
--- a/drivers/staging/android/binder.h
+++ b/drivers/staging/android/binder.h
@@ -87,10 +87,9 @@ struct binder_version {
 #define BINDER_WRITE_READ  _IOWR('b', 1, struct binder_write_read)
 #define BINDER_SET_IDLE_TIMEOUT_IOW('b', 3, __s64)
 #define BINDER_SET_MAX_THREADS _IOW('b', 5, __u32)
-#define BINDER_SET_IDLE_PRIORITY   _IOW('b', 6, __s32)
-#define BINDER_SET_CONTEXT_MGR _IOW('b', 7, __s32)
-#define BINDER_THREAD_EXIT _IOW('b', 8, __s32)
-#define BINDER_VERSION _IOWR('b', 9, struct binder_version)
+#define BINDER_SET_CONTEXT_MGR _IOW('b', 6, __s32)
+#define BINDER_THREAD_EXIT _IOW('b', 7, __s32)
+#define BINDER_VERSION _IOWR('b', 8, struct binder_version)
 
 /*
  * NOTE: Two special error codes you should check for when calling
-- 
1.8.1.2

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


[PATCH V2] staging: r8188eu: Fix missing header

2014-02-07 Thread Larry Finger
Commit 2397c6e0927675d983b34a03401affdb64818d07 entitled "staging: r8188eu:
Remove wrappers around vmalloc and vzalloc" and
commit: 03bd6aea7ba610a1a19f840c373624b8b0adde0d entitled "staging: r8188eu:
Remove wrappers around vfree" failed to add the header file needed
to provide vzalloc and vfree.

This problem was reported by the kbuild test robot.

Signed-off-by: Larry Finger 
---

V2 - add attribution to the build robot
---

 drivers/staging/rtl8188eu/core/rtw_mlme.c  | 1 +
 drivers/staging/rtl8188eu/core/rtw_mp.c| 1 +
 drivers/staging/rtl8188eu/core/rtw_recv.c  | 1 +
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c   | 1 +
 drivers/staging/rtl8188eu/core/rtw_xmit.c  | 1 +
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 1 +
 drivers/staging/rtl8188eu/os_dep/usb_intf.c| 1 +
 7 files changed, 7 insertions(+)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 2037be0..927fc72 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 extern unsigned char   MCS_rate_2R[16];
 extern unsigned char   MCS_rate_1R[16];
diff --git a/drivers/staging/rtl8188eu/core/rtw_mp.c 
b/drivers/staging/rtl8188eu/core/rtw_mp.c
index 9e97b57..99c06c4 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mp.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mp.c
@@ -23,6 +23,7 @@
 
 #include "odm_precomp.h"
 #include "rtl8188e_hal.h"
+#include 
 
 u32 read_macreg(struct adapter *padapter, u32 addr, u32 sz)
 {
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 8490d51..ed308ff 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static u8 SNAP_ETH_TYPE_IPX[2] = {0x81, 0x37};
 static u8 SNAP_ETH_TYPE_APPLETALK_AARP[2] = {0x80, 0xf3};
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c 
b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 6df9669..e8a654d 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static void _rtw_init_stainfo(struct sta_info *psta)
 {
diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index aa77270..2c0a40f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
 static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 0204082..f3584dd 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -35,6 +35,7 @@
 
 #include 
 #include 
+#include 
 
 #define RTL_IOCTL_WPA_SUPPLICANT   (SIOCIWFIRSTPRIV + 30)
 
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index 0a585b2..8ad3948 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
-- 
1.8.4.5

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


RE: [PATCH V2 1/1] Drivers: hv: vmbus: Extract the mmio information from DSDT

2014-02-07 Thread KY Srinivasan


> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Friday, February 07, 2014 3:21 PM
> To: KY Srinivasan
> Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; 
> o...@aepfle.de;
> a...@canonical.com; jasow...@redhat.com
> Subject: Re: [PATCH V2 1/1] Drivers: hv: vmbus: Extract the mmio information
> from DSDT
> 
> On Wed, Jan 29, 2014 at 06:14:39PM -0800, K. Y. Srinivasan wrote:
> > On Gen2 firmware, Hyper-V does not emulate the PCI bus. However, the
> MMIO
> > information is packaged up in DSDT. Extract this information and export it
> > for use by the synthetic framebuffer driver. This is the only driver that
> > needs this currently.
> 
> I don't see a follow-on patch that uses these variables, where is that?

The synthetic framebuffer driver will use this. It will be submitted shortly.

K. Y 
> 
> thanks,
> 
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RFC 0/2] drivers/base: simplify simple DT-based components

2014-02-07 Thread Russell King - ARM Linux
On Fri, Feb 07, 2014 at 06:59:11PM +, Russell King - ARM Linux wrote:
> Sorry.  Deferred probe does work, it's been tested with imx-drm, not
> only from the master component but also the sub-components.  There's
> no problem here.

Here's the proof that it also works with the Cubox, and armada DRM:

[drm] Initialized drm 1.1.0 20060810
...
armada-drm armada-510-drm: master bind failed: -517
i2c 0-0070: Driver tda998x requests probe deferral
...
tda998x 0-0070: found TDA19988
armada-drm armada-510-drm: bound 0-0070 (ops tda998x_ops)

So, in the above sequence, the armada DRM driver was bound to its driver
initially, but the TDA998x driver wasn't.

Then, the TDA998x driver is bound, which completes the requirements for
the DRM master.  So the system attempts to bind.

In doing so, the master probe function discovers a missing clock (because
the SIL5531 driver hasn't probed) and it returns -EPROBE_DEFER.  This
causes the probe of the TDA998x to be deferred.

Later, deferred probes are run - at this time the SIL5531 driver has
probed its device, and the clocks are now available.  So when the TDA998x
driver is re-probed, it retriggers the binding attempt, and as the clock
can now be found, the system is bound and the DRM system for the device
is initialised.

I've just committed a patch locally which makes Armada DRM fully use
the component helper, which removes in totality the four armada_output.*
and armada_slave.* files since they're no longer required:

[cubox-3.13 e2713ff5ac2f] DRM: armada: remove non-component support
 7 files changed, 8 insertions(+), 437 deletions(-)
 delete mode 100644 drivers/gpu/drm/armada/armada_output.c
 delete mode 100644 drivers/gpu/drm/armada/armada_output.h
 delete mode 100644 drivers/gpu/drm/armada/armada_slave.c
 delete mode 100644 drivers/gpu/drm/armada/armada_slave.h

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: r8188eu: Fix missing header

2014-02-07 Thread Larry Finger

On 02/07/2014 06:04 PM, Greg KH wrote:

On Fri, Feb 07, 2014 at 05:12:10PM -0600, Larry Finger wrote:

Commit 2397c6e0927675d983b34a03401affdb64818d07 entitled "staging: r8188eu:
Remove wrappers around vmalloc and vzalloc" and
commit: 03bd6aea7ba610a1a19f840c373624b8b0adde0d entitled "staging: r8188eu:
Remove wrappers around vfree" failed to add the header file needed
to provide vzalloc and vfree.

Signed-off-by: Larry Finger 


Was this reported by the 0-day bot?  If so, please credit it.


Yes it was. V2 coming soon.

Larry


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


Re: [PATCH] staging: r8188eu: Fix missing header

2014-02-07 Thread Greg KH
On Fri, Feb 07, 2014 at 05:12:10PM -0600, Larry Finger wrote:
> Commit 2397c6e0927675d983b34a03401affdb64818d07 entitled "staging: r8188eu:
> Remove wrappers around vmalloc and vzalloc" and
> commit: 03bd6aea7ba610a1a19f840c373624b8b0adde0d entitled "staging: r8188eu:
> Remove wrappers around vfree" failed to add the header file needed
> to provide vzalloc and vfree.
> 
> Signed-off-by: Larry Finger 

Was this reported by the 0-day bot?  If so, please credit it.

thanks,

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


[PATCH] staging: r8188eu: Fix missing header

2014-02-07 Thread Larry Finger
Commit 2397c6e0927675d983b34a03401affdb64818d07 entitled "staging: r8188eu:
Remove wrappers around vmalloc and vzalloc" and
commit: 03bd6aea7ba610a1a19f840c373624b8b0adde0d entitled "staging: r8188eu:
Remove wrappers around vfree" failed to add the header file needed
to provide vzalloc and vfree.

Signed-off-by: Larry Finger 
---
 drivers/staging/rtl8188eu/core/rtw_mlme.c  | 1 +
 drivers/staging/rtl8188eu/core/rtw_mp.c| 1 +
 drivers/staging/rtl8188eu/core/rtw_recv.c  | 1 +
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c   | 1 +
 drivers/staging/rtl8188eu/core/rtw_xmit.c  | 1 +
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 1 +
 drivers/staging/rtl8188eu/os_dep/usb_intf.c| 1 +
 7 files changed, 7 insertions(+)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme.c
index 2037be0..927fc72 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c
@@ -31,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 extern unsigned char   MCS_rate_2R[16];
 extern unsigned char   MCS_rate_1R[16];
diff --git a/drivers/staging/rtl8188eu/core/rtw_mp.c 
b/drivers/staging/rtl8188eu/core/rtw_mp.c
index 9e97b57..99c06c4 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mp.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mp.c
@@ -23,6 +23,7 @@
 
 #include "odm_precomp.h"
 #include "rtl8188e_hal.h"
+#include 
 
 u32 read_macreg(struct adapter *padapter, u32 addr, u32 sz)
 {
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index 8490d51..ed308ff 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -28,6 +28,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static u8 SNAP_ETH_TYPE_IPX[2] = {0x81, 0x37};
 static u8 SNAP_ETH_TYPE_APPLETALK_AARP[2] = {0x80, 0xf3};
diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c 
b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 6df9669..e8a654d 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static void _rtw_init_stainfo(struct sta_info *psta)
 {
diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c 
b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index aa77270..2c0a40f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static u8 P802_1H_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0xf8 };
 static u8 RFC1042_OUI[P80211_OUI_LEN] = { 0x00, 0x00, 0x00 };
diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
index 0204082..f3584dd 100644
--- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
@@ -35,6 +35,7 @@
 
 #include 
 #include 
+#include 
 
 #define RTL_IOCTL_WPA_SUPPLICANT   (SIOCIWFIRSTPRIV + 30)
 
diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c 
b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
index 0a585b2..8ad3948 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
-- 
1.8.4.5

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


Re: [PATCH V2 1/1] Drivers: hv: vmbus: Extract the mmio information from DSDT

2014-02-07 Thread Greg KH
On Wed, Jan 29, 2014 at 06:14:39PM -0800, K. Y. Srinivasan wrote:
> On Gen2 firmware, Hyper-V does not emulate the PCI bus. However, the MMIO
> information is packaged up in DSDT. Extract this information and export it
> for use by the synthetic framebuffer driver. This is the only driver that
> needs this currently.

I don't see a follow-on patch that uses these variables, where is that?

thanks,

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


Re: [PATCH V4 1/1] Drivers: hv: Implement the file copy service

2014-02-07 Thread Greg KH
On Tue, Jan 21, 2014 at 05:43:53PM -0800, K. Y. Srinivasan wrote:
> +/*
> + * Create a char device that can support read/write for passing
> + * the payload.
> + */
> +static struct cdev fcopy_cdev;
> +static struct class *cl;
> +static struct device *sysfs_dev;

Why not just be a misc device, you only want 1 minor number for a char
device:

> +static int fcopy_dev_init(void)
> +{
> + int result;
> +
> + result = alloc_chrdev_region(&fcopy_dev, 1, 1, "hv_fcopy");

See, one minor.

> + if (result < 0) {
> + pr_err("Cannot get major number\n");
> + return result;
> + }
> +
> + cl = class_create(THIS_MODULE, "chardev");

That's a _really_ generic name, come on, you know better than that.

> + if (IS_ERR(cl)) {
> + pr_err("Error creating fcopy class.\n");

Your error string is wrong :(

> + result = PTR_ERR(cl);
> + goto err_unregister;
> + }
> +
> + sysfs_dev = device_create(cl, NULL, fcopy_dev, "%s", "hv_fcopy");

A device at the root of sysfs?  No, you have a bus to hang devices off
of, use that.  What do you need this device for anyway?

> + if (IS_ERR(sysfs_dev)) {
> + pr_err("Device creation failed\n");
> + result = PTR_ERR(cl);
> + goto err_destroy_class;
> + }
> +
> + cdev_init(&fcopy_cdev, &fcopy_fops);
> + fcopy_cdev.owner = THIS_MODULE;
> + fcopy_cdev.ops = &fcopy_fops;
> +
> + result = cdev_add(&fcopy_cdev, fcopy_dev, 1);

Ah, to get udev to pay attention to the char device, no, just use a misc
device, should make this whole code a lot simpler and more "obvious" as
to what you want/need.

> + if (result) {
> + pr_err("Cannot cdev_add\n");
> + goto err_destroy_device;
> + }
> + return result;
> +
> +err_destroy_device:
> + device_destroy(cl, fcopy_dev);
> +err_destroy_class:
> + class_destroy(cl);
> +err_unregister:
> + unregister_chrdev_region(fcopy_dev, 1);
> + return result;


Ugh, I hate the cdev interface, one of these days I'll fix it up, it's
so unwieldy...

> +static void fcopy_dev_deinit(void)
> +{
> + /*
> +  * first kill the daemon.
> +  */
> + if (dtp != NULL)
> + send_sig(SIGKILL, dtp, 0);

We kill userspace daemon's from the kernel?  That's a recipe for
disaster...

Why?  What does it matter here if the daemon keeps running, it should
fail gracefully if the character device is removed, right?  If not, that
needs to be fixed anyway.

thanks,

greg k-h

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


Re: [PATCH v3 0/3] Add modules for realtek USB card reader

2014-02-07 Thread Greg Kroah-Hartman
On Thu, Feb 06, 2014 at 10:35:04PM +0800, rogera...@realtek.com wrote:
> From: Roger Tseng 
> 
> This patchset adds modules to support Realtek USB vendor specific class flash
> card reader: one base module in MFD subsystem and two host modules in both mmc
> and memstick subsystems. The architecture is similar to rtsx_pci.
> 
> This work is done primarily to replace the staging driver: staging/rts5139,
> which doesn't utilize mmc nor memstick subsystems. Once the patchset or its
> revision is applied, we may need Greg's help to remove the staging one.
> 
> v2:
> 1. Fix potential buffer overflow in rtsx_usb_seq_write_register()
> 2. Remove unnecessary casting and messages
> 3. Revise coding style and white spaces
> 
> v3:
> 1. Fix MMC detection fail when under xhci
> 2. Minor change of pm_runtime behavior in rtsx_usb_ms to prevent some rare
>freeze due to erroneous Memstick card(not MS-Pro)
> 3. Further revise coding style as suggested in the thread of v2
> 4. Using managed resources: devm_*
> 5. Change license from "GPL v2 and later" to "GPL v2"
> 
> Roger Tseng (3):
>   mfd: Add realtek USB card reader driver
>   mmc: Add realtek USB sdmmc host driver
>   memstick: Add realtek USB memstick host driver

Looks good to me, thanks for doing this work:

Acked-by: Greg Kroah-Hartman 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RFC 0/2] drivers/base: simplify simple DT-based components

2014-02-07 Thread Russell King - ARM Linux
On Fri, Feb 07, 2014 at 06:11:08PM +0100, Jean-Francois Moine wrote:
> This patch series tries to simplify the code of simple devices in case
> they are part of componentised subsystems, are declared in a DT, and
> are not using the component bin/unbind functions.

Here's my changes to the TDA998x driver to add support for the component
helper.  The TDA998x driver retains support for the old way so that
drivers can be transitioned.  For any one DRM "card" the transition to
using the component layer must be all-in or all-out - partial transitions
are not permitted with the simple locking implementation currently in
the component helper due to the possibility of deadlock.  (Master
binds, holding the component lock, master declares i2c device, i2c
device is bound to tda998x, which tries to register with the component
layer, trying to take the held lock.)

http://ftp.arm.linux.org.uk/cgit/linux-cubox.git/log/?h=unstable/tda998x-devel

It's marked unstable because the two "drivers/base" commits in there are
_not_ the upstream commits.  You'll notice that I just sent one of those
to Gregkh in patch form.

Now, the bits which aren't in that branch but which update the Armada
driver is the below, which needs some clean up and removal of some local
differences I have in my cubox tree, but nicely illustrates why /your/
patches to the component stuff is the wrong approach.

Not only does the patch below add support for using the componentised
TDA998x driver in the above link, but it allows that componentised support
to be specified not only via platform data but also via DT.  The DT
stuff is untested, but it works exactly the same way as imx-drm does
which has been tested.

And yes, I'm thinking that maybe moving compare_of() into the component
support so that drivers can share this generic function may be a good
idea.

So... as I've been saying, no changes to component.c are required here.

diff --git a/drivers/gpu/drm/armada/armada_drv.c 
b/drivers/gpu/drm/armada/armada_drv.c
index 6f6554bac93f..1f2b7c60bff9 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -6,7 +6,9 @@
  * published by the Free Software Foundation.
  */
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 #include "armada_crtc.h"
@@ -53,6 +55,11 @@ static const struct armada_drm_slave_config tda19988_config 
= {
 };
 #endif
 
+static bool is_componentized(struct device *dev)
+{
+   return dev->of_node || dev->platform_data;
+}
+
 static void armada_drm_unref_work(struct work_struct *work)
 {
struct armada_private *priv =
@@ -171,16 +178,22 @@ static int armada_drm_load(struct drm_device *dev, 
unsigned long flags)
goto err_kms;
}
 
+   if (is_componentized(dev->dev)) {
+   ret = component_bind_all(dev->dev, dev);
+   if (ret)
+   goto err_kms;
+   } else {
 #ifdef CONFIG_DRM_ARMADA_TDA1998X
-   ret = armada_drm_connector_slave_create(dev, &tda19988_config);
-   if (ret)
-   goto err_kms;
+   ret = armada_drm_connector_slave_create(dev, &tda19988_config);
+   if (ret)
+   goto err_kms;
 #endif
 #ifdef CONFIG_DRM_ARMADA_TDA1998X_NXP
-   ret = armada_drm_tda19988_nxp_create(dev);
-   if (ret)
-   goto err_kms;
+   ret = armada_drm_tda19988_nxp_create(dev);
+   if (ret)
+   goto err_kms;
 #endif
+   }
 
ret = drm_vblank_init(dev, n);
if (ret)
@@ -204,6 +217,10 @@ static int armada_drm_load(struct drm_device *dev, 
unsigned long flags)
drm_irq_uninstall(dev);
  err_kms:
drm_mode_config_cleanup(dev);
+
+   if (is_componentized(dev->dev))
+   component_unbind_all(dev->dev, dev);
+
drm_mm_takedown(&priv->linear);
flush_work(&priv->fb_unref_work);
 
@@ -218,6 +235,10 @@ static int armada_drm_unload(struct drm_device *dev)
armada_fbdev_fini(dev);
drm_irq_uninstall(dev);
drm_mode_config_cleanup(dev);
+
+   if (is_componentized(dev->dev))
+   component_unbind_all(dev->dev, dev);
+
drm_mm_takedown(&priv->linear);
flush_work(&priv->fb_unref_work);
dev->dev_private = NULL;
@@ -380,14 +401,82 @@ static struct drm_driver armada_drm_driver = {
.fops   = &armada_drm_fops,
 };
 
+static int armada_drm_bind(struct device *dev)
+{
+   return drm_platform_init(&armada_drm_driver, to_platform_device(dev));
+}
+
+static void armada_drm_unbind(struct device *dev)
+{
+   drm_platform_exit(&armada_drm_driver, to_platform_device(dev));
+}
+
+static int compare_of(struct device *dev, void *data)
+{
+   return dev->of_node == data;
+}
+
+static int armada_drm_compare_name(struct device *dev, void *data)
+{
+   const char *name = data;
+   return !strcmp(dev_name(dev), name);
+}
+
+static int armada_drm_add_components(struct devi

RE: Drivers/hv

2014-02-07 Thread KY Srinivasan


> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Friday, February 07, 2014 11:12 AM
> To: KY Srinivasan
> Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; 
> o...@aepfle.de;
> a...@canonical.com; jasow...@redhat.com
> Subject: Re: Drivers/hv
> 
> On Fri, Feb 07, 2014 at 07:06:00PM +, KY Srinivasan wrote:
> >
> >
> > > -Original Message-
> > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > Sent: Wednesday, January 29, 2014 1:16 PM
> > > To: KY Srinivasan
> > > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org;
> o...@aepfle.de;
> > > a...@canonical.com; jasow...@redhat.com
> > > Subject: Re: Drivers/hv
> > >
> > > On Wed, Jan 29, 2014 at 07:57:29AM -0800, K. Y. Srinivasan wrote:
> > > >
> > > > Greg,
> > > >
> > > > Some time back I had sent a buch of patches for
> > > > Hyper-V drivers. Are they still in the queue or should I resend
> > > > them.
> > >
> > > Which specific patches are you referring to?  I can't take anything
> > > until after 3.14-rc1 is out, and I do see a few from you in my queue, so
> > > if you want to resend, please do, but note I will not get to them until
> > > sometime late next week at the earliest.
> >
> > I saw that you committed two (hv) patches earlier today. There are still a 
> > few
> more
> > patches that are not committed yet; should I resend those?
> 
> No, I am slowly going through my backlog (over 800 patches).  I applied
> the ones that are needed for 3.14 at the moment, will catch with the
> rest later, please give me a chance...

Thanks Greg.

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


Re: Drivers/hv

2014-02-07 Thread Greg KH
On Fri, Feb 07, 2014 at 07:06:00PM +, KY Srinivasan wrote:
> 
> 
> > -Original Message-
> > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > Sent: Wednesday, January 29, 2014 1:16 PM
> > To: KY Srinivasan
> > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; 
> > o...@aepfle.de;
> > a...@canonical.com; jasow...@redhat.com
> > Subject: Re: Drivers/hv
> > 
> > On Wed, Jan 29, 2014 at 07:57:29AM -0800, K. Y. Srinivasan wrote:
> > >
> > > Greg,
> > >
> > > Some time back I had sent a buch of patches for
> > > Hyper-V drivers. Are they still in the queue or should I resend
> > > them.
> > 
> > Which specific patches are you referring to?  I can't take anything
> > until after 3.14-rc1 is out, and I do see a few from you in my queue, so
> > if you want to resend, please do, but note I will not get to them until
> > sometime late next week at the earliest.
> 
> I saw that you committed two (hv) patches earlier today. There are still a 
> few more
> patches that are not committed yet; should I resend those?

No, I am slowly going through my backlog (over 800 patches).  I applied
the ones that are needed for 3.14 at the moment, will catch with the
rest later, please give me a chance...

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


RE: Drivers/hv

2014-02-07 Thread KY Srinivasan


> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Wednesday, January 29, 2014 1:16 PM
> To: KY Srinivasan
> Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; 
> o...@aepfle.de;
> a...@canonical.com; jasow...@redhat.com
> Subject: Re: Drivers/hv
> 
> On Wed, Jan 29, 2014 at 07:57:29AM -0800, K. Y. Srinivasan wrote:
> >
> > Greg,
> >
> > Some time back I had sent a buch of patches for
> > Hyper-V drivers. Are they still in the queue or should I resend
> > them.
> 
> Which specific patches are you referring to?  I can't take anything
> until after 3.14-rc1 is out, and I do see a few from you in my queue, so
> if you want to resend, please do, but note I will not get to them until
> sometime late next week at the earliest.

I saw that you committed two (hv) patches earlier today. There are still a few 
more
patches that are not committed yet; should I resend those?

Regards,

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


Re: [PATCH RFC 0/2] drivers/base: simplify simple DT-based components

2014-02-07 Thread Russell King - ARM Linux
On Fri, Feb 07, 2014 at 07:42:04PM +0100, Jean-Francois Moine wrote:
> On Fri, 7 Feb 2014 17:33:26 +
> Russell King - ARM Linux  wrote:
> 
> > On Fri, Feb 07, 2014 at 06:11:08PM +0100, Jean-Francois Moine wrote:
> > > This patch series tries to simplify the code of simple devices in case
> > > they are part of componentised subsystems, are declared in a DT, and
> > > are not using the component bin/unbind functions.
> > 
> > I wonder - I said earlier today that this works absolutely fine without
> > modification with DT, so why are you messing about with it adding DT
> > support?
> > 
> > This is totally the wrong approach.  The idea is that this deals with
> > /devices/ and /devices/ only.  It groups up /devices/.
> > 
> > It's up to the add_component callback to the master device to decide
> > how to deal with that.
> > 
> > > Jean-Francois Moine (2):
> > >   drivers/base: permit base components to omit the bind/unbind ops
> > 
> > And this patch has me wondering if you even understand how to use
> > this...  The master bind/unbind callbacks are the ones which establish
> > the "card" based context with the subsystem.
> > 
> > Please, before buggering up this nicely designed implementation, please
> > /first/ look at the imx-drm rework which was posted back in early January
> > which illustrates how this is used in a DT context - which is something
> > I've already pointed you at once today already.
> 
> As I told in a previous mail, your code works fine in my DT-based
> Cubox. I am rewriting the TDA988x as a normal encoder/connector, and,
> yes, the bind/unbind functions are useful in this case.

So, which bit of "I've already got that" was missed?

> But you opened a door. In a DT context, you know that the probe_defer
> mechanism does not work correctly. Your work permits to solve delicate
> cases: your component_add tells exactly when a device is available, and
> the master bind callback is the green signal for the device waiting for
> its resources. Indeed, your system was not created for such a usage,
> but it works as it is (anyway, the component bind/unbind functions may
> be empty...).

Sorry.  Deferred probe does work, it's been tested with imx-drm, not
only from the master component but also the sub-components.  There's
no problem here.

And no component bind/unbind function should ever be empty.

Again, I put it to you that you don't understand this layer.

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 5/5] drivers:staging:dgnc:dpacompat.h- removed checkpatch.pl reported warnings

2014-02-07 Thread Greg KH
On Thu, Jan 30, 2014 at 07:14:02PM +0530, Avinash kumar wrote:
> drivers:staging:dgnc:dpacompat.h- removed following checkpatch.pl reported 
> warnings
> 
> sccc@ubuntu:~/lk/rc/linux$ ./scripts/checkpatch.pl --terse --file 
> drivers/staging/dgnc/dpacompat.h 
> drivers/staging/dgnc/dpacompat.h:109: ERROR: Macros with complex values 
> should be enclosed in parenthesis
> drivers/staging/dgnc/dpacompat.h:110: ERROR: Macros with complex values 
> should be enclosed in parenthesis
> drivers/staging/dgnc/dpacompat.h:111: ERROR: Macros with complex values 
> should be enclosed in parenthesis
> drivers/staging/dgnc/dpacompat.h:114: WARNING: line over 80 characters
> drivers/staging/dgnc/dpacompat.h:114: ERROR: Macros with complex values 
> should be enclosed in parenthesis
> drivers/staging/dgnc/dpacompat.h:115: WARNING: line over 80 characters
> drivers/staging/dgnc/dpacompat.h:115: ERROR: Macros with complex values 
> should be enclosed in parenthesis
> total: 5 errors, 2 warnings, 115 lines checked
> 
> Signed-off-by: Avinash Kumar 

I don't think you built the driver after making this change, otherwise
all of the build warnings you just added would have hinted that this fix
was not correct :(

Please be more careful in the future and always test your patches before
sending them out.

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


Re: [PATCH RFC 0/2] drivers/base: simplify simple DT-based components

2014-02-07 Thread Jean-Francois Moine
On Fri, 7 Feb 2014 17:33:26 +
Russell King - ARM Linux  wrote:

> On Fri, Feb 07, 2014 at 06:11:08PM +0100, Jean-Francois Moine wrote:
> > This patch series tries to simplify the code of simple devices in case
> > they are part of componentised subsystems, are declared in a DT, and
> > are not using the component bin/unbind functions.
> 
> I wonder - I said earlier today that this works absolutely fine without
> modification with DT, so why are you messing about with it adding DT
> support?
> 
> This is totally the wrong approach.  The idea is that this deals with
> /devices/ and /devices/ only.  It groups up /devices/.
> 
> It's up to the add_component callback to the master device to decide
> how to deal with that.
> 
> > Jean-Francois Moine (2):
> >   drivers/base: permit base components to omit the bind/unbind ops
> 
> And this patch has me wondering if you even understand how to use
> this...  The master bind/unbind callbacks are the ones which establish
> the "card" based context with the subsystem.
> 
> Please, before buggering up this nicely designed implementation, please
> /first/ look at the imx-drm rework which was posted back in early January
> which illustrates how this is used in a DT context - which is something
> I've already pointed you at once today already.

As I told in a previous mail, your code works fine in my DT-based
Cubox. I am rewriting the TDA988x as a normal encoder/connector, and,
yes, the bind/unbind functions are useful in this case.

But you opened a door. In a DT context, you know that the probe_defer
mechanism does not work correctly. Your work permits to solve delicate
cases: your component_add tells exactly when a device is available, and
the master bind callback is the green signal for the device waiting for
its resources. Indeed, your system was not created for such a usage,
but it works as it is (anyway, the component bind/unbind functions may
be empty...).

-- 
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef |   http://moinejf.free.fr/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RESEND 3/3] staging: et131x: fix make W=1 build warning

2014-02-07 Thread Greg Kroah-Hartman
On Thu, Feb 06, 2014 at 12:10:36AM +0800, Zhao, Gang wrote:
> fix make W=1 warning:
> drivers/staging/et131x/et131x.c: In function 
> ‘et1310_setup_device_for_multicast’:
> drivers/staging/et131x/et131x.c:1052:6: warning: variable ‘pm_csr’ set but 
> not used [-Wunused-but-set-variable]
>   u32 pm_csr;
>   ^
> drivers/staging/et131x/et131x.c: In function 
> ‘et1310_setup_device_for_unicast’:
> drivers/staging/et131x/et131x.c:1101:6: warning: variable ‘pm_csr’ set but 
> not used [-Wunused-but-set-variable]
>   u32 pm_csr;
>   ^
> drivers/staging/et131x/et131x.c: In function ‘et131x_isr_handler’:
> drivers/staging/et131x/et131x.c:4006:8: warning: variable ‘pm_csr’ set but 
> not used [-Wunused-but-set-variable]
> u32 pm_csr;
> ^
> 
> Signed-off-by: Zhao, Gang 
> ---
>  drivers/staging/et131x/et131x.c | 7 ---
>  1 file changed, 7 deletions(-)
> 
> diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
> index 6413500..0c44014 100644
> --- a/drivers/staging/et131x/et131x.c
> +++ b/drivers/staging/et131x/et131x.c
> @@ -1049,7 +1049,6 @@ static void et1310_setup_device_for_multicast(struct 
> et131x_adapter *adapter)
>   u32 hash2 = 0;
>   u32 hash3 = 0;
>   u32 hash4 = 0;
> - u32 pm_csr;
>  
>   /* If ET131X_PACKET_TYPE_MULTICAST is specified, then we provision
>* the multi-cast LIST.  If it is NOT specified, (and "ALL" is not
> @@ -1083,7 +1082,6 @@ static void et1310_setup_device_for_multicast(struct 
> et131x_adapter *adapter)
>   }
>  
>   /* Write out the new hash to the device */
> - pm_csr = readl(&adapter->regs->global.pm_csr);

Some types of hardware require a read in order to do something, are you
sure that this hardware doesn't also need this?  Have you tested the
code with this change?

thanks,

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


Re: [PATCH] staging: ced1401: fix coding style in ced_ioc.c (resend)

2014-02-07 Thread Greg KH
On Wed, Jan 15, 2014 at 10:37:13PM +0100, Pol Eyschen wrote:
> Fixed checkpatch.pl issues and removed redundant comment in ced_ioc.cs
> 
> Signed-off-by: Pol Eyschen 
> ---
>  drivers/staging/ced1401/ced_ioc.c |  483 
> +
>  1 file changed, 271 insertions(+), 212 deletions(-)
> 
> diff --git a/drivers/staging/ced1401/ced_ioc.c 
> b/drivers/staging/ced1401/ced_ioc.c
> index bf532b1..94a361d 100644
> --- a/drivers/staging/ced1401/ced_ioc.c
> +++ b/drivers/staging/ced1401/ced_ioc.c
> @@ -40,8 +40,8 @@ static void FlushOutBuff(DEVICE_EXTENSION *pdx)
>  {
>   dev_dbg(&pdx->interface->dev, "%s currentState=%d", __func__,
>   pdx->sCurrentState);
> - if (pdx->sCurrentState == U14ERR_TIME)  /* Do nothing if hardware in 
> trouble */
> - return;
> + if (pdx->sCurrentState == U14ERR_TIME)
> + return; /* Do nothing if hardware in trouble */

That's really not a good cleanup, is it?

And this patch no longer applies to my tree, care to fix it up and
resend?

thanks,

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


Re: [PATCH RFC 2/2] drivers/base: declare phandle DT nodes as components

2014-02-07 Thread Russell King - ARM Linux
On Fri, Feb 07, 2014 at 05:53:27PM +0100, Jean-Francois Moine wrote:
> At system startup time, some devices depends on the availability of
> some other devices before starting. The infrastructure for componentised
> subsystems permits to handle this dependence, each driver defining
> its own role.
> 
> This patch does an automatic creation of the lowest components in
> case of DT. This permits simple devices to be part of complex
> componentised subsystems without any specific code.

A component with no operations makes precisely no sense - with that,
there's no way for the component to be a stand-alone driver.  Your
approach forces your ideas onto every DT device that is referenced
as a phandle.  That's extremely restrictive.

I don't want the component stuff knowing anything about OF.  I don't
want it knowing about driver matching.  I don't want it knowing about
ACPI either.  That's the whole point behind it - it is 100% agnostic
about how that stuff works.

The model is quite simply this:

- a master device is the covering component for the "card"
  - the master device knows what components to expect by some means.
In the case of DT, that's by phandle references to the components.
  - the master device handles the component independent setup of the
"card", creating the common resources that are required.  When it's
ready, it asks for the components to be bound.
  - upon removal of any component, the master component is unbound,
which triggers the removal of the "card" from the subsystem.
  - as part of the removal, sub-components are unbound.
  - the master device should have as /little/ knowledge about the
components as possible to permit component re-use.

- a component driver should be independent of it's master.
  - A component which is probed from the device model should simply
register itself using component_add() with an appropriate operations
structure, and a removal function which deletes itself.
  - When the driver is ready to be initialised (when the "card" level
resources have been set in place) the "bind" method will be called.
At this point, the component does everything that a classical driver
model driver would do in it's probe callback.
  - unbind is the same as remove in the classical driver model.

So, please, no DT stuff in the component support - it's simply not
required.

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RFC 0/2] drivers/base: simplify simple DT-based components

2014-02-07 Thread Russell King - ARM Linux
On Fri, Feb 07, 2014 at 06:11:08PM +0100, Jean-Francois Moine wrote:
> This patch series tries to simplify the code of simple devices in case
> they are part of componentised subsystems, are declared in a DT, and
> are not using the component bin/unbind functions.

I wonder - I said earlier today that this works absolutely fine without
modification with DT, so why are you messing about with it adding DT
support?

This is totally the wrong approach.  The idea is that this deals with
/devices/ and /devices/ only.  It groups up /devices/.

It's up to the add_component callback to the master device to decide
how to deal with that.

> Jean-Francois Moine (2):
>   drivers/base: permit base components to omit the bind/unbind ops

And this patch has me wondering if you even understand how to use
this...  The master bind/unbind callbacks are the ones which establish
the "card" based context with the subsystem.

Please, before buggering up this nicely designed implementation, please
/first/ look at the imx-drm rework which was posted back in early January
which illustrates how this is used in a DT context - which is something
I've already pointed you at once today already.

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RFC 1/2] drivers/base: permit base components to omit the bind/unbind ops

2014-02-07 Thread Russell King - ARM Linux
On Fri, Feb 07, 2014 at 04:55:00PM +0100, Jean-Francois Moine wrote:
> Some simple components don't need to do any specific action on
> bind to / unbind from a master component.
> 
> This patch permits such components to omit the bind/unbind
> operations.
> 
> Signed-off-by: Jean-Francois Moine 
> ---
>  drivers/base/component.c | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/component.c b/drivers/base/component.c
> index c53efe6..0a39d7a 100644
> --- a/drivers/base/component.c
> +++ b/drivers/base/component.c
> @@ -225,7 +225,8 @@ static void component_unbind(struct component *component,
>  {
>   WARN_ON(!component->bound);
>  
> - component->ops->unbind(component->dev, master->dev, data);
> + if (component->ops)
> + component->ops->unbind(component->dev, master->dev, data);
>   component->bound = false;
>  
>   /* Release all resources claimed in the binding of this component */
> @@ -274,7 +275,11 @@ static int component_bind(struct component *component, 
> struct master *master,
>   dev_dbg(master->dev, "binding %s (ops %ps)\n",
>   dev_name(component->dev), component->ops);
>  
> - ret = component->ops->bind(component->dev, master->dev, data);
> + if (component->ops)
> + ret = component->ops->bind(component->dev, master->dev, data);
> + else
> + ret = 0;
> +

NAK.  If this is done, there's absolutely no point to this code.

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 0/2] *** SUBJECT HERE ***

2014-02-07 Thread Greg Kroah-Hartman
On Fri, Feb 07, 2014 at 06:09:46PM +0100, Jean-Francois Moine wrote:
> *** BLURB HERE ***

Subject and BLURB forgotten?

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


[PATCH v3 0/2] *** SUBJECT HERE ***

2014-02-07 Thread Jean-Francois Moine
*** BLURB HERE ***

Jean-Francois Moine (2):
  drivers/base: permit base components to omit the bind/unbind ops
  drivers/base: declare phandle DT nodes as components

 drivers/base/component.c | 21 +++--
 drivers/base/core.c  | 18 ++
 include/linux/of.h   |  2 ++
 3 files changed, 39 insertions(+), 2 deletions(-)

-- 
1.9.rc1

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


[PATCH v3 2/2] drivers/base: declare phandle DT nodes as components

2014-02-07 Thread Jean-Francois Moine
At system startup time, some devices depends on the availability of
some other devices before starting. The infrastructure for componentised
subsystems permits to handle this dependence, each driver defining
its own role.

This patch does an automatic creation of the lowest components in
case of DT. This permits simple devices to be part of complex
componentised subsystems without any specific code.

When created from DT, the device dependence is generally indicated by
phandle: a device which is pointed to by a phandle must be started
before the pointing device(s).

So, at device register time, the devices which are pointed to by a
phandle are declared as components, except when they declared
themselves as such in their probe function.

Signed-off-by: Jean-Francois Moine 
---
 drivers/base/component.c | 12 
 drivers/base/core.c  | 18 ++
 include/linux/of.h   |  2 ++
 3 files changed, 32 insertions(+)

diff --git a/drivers/base/component.c b/drivers/base/component.c
index 0a39d7a..3cab26b 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct master {
struct list_head node;
@@ -336,6 +337,7 @@ EXPORT_SYMBOL_GPL(component_bind_all);
 int component_add(struct device *dev, const struct component_ops *ops)
 {
struct component *component;
+   struct device_node *np;
int ret;
 
component = kzalloc(sizeof(*component), GFP_KERNEL);
@@ -356,6 +358,11 @@ int component_add(struct device *dev, const struct 
component_ops *ops)
 
kfree(component);
}
+
+   np = dev->of_node;
+   if (np)
+   np->_flags |= OF_DEV_COMPONENT;
+
mutex_unlock(&component_mutex);
 
return ret < 0 ? ret : 0;
@@ -365,6 +372,7 @@ EXPORT_SYMBOL_GPL(component_add);
 void component_del(struct device *dev, const struct component_ops *ops)
 {
struct component *c, *component = NULL;
+   struct device_node *np;
 
mutex_lock(&component_mutex);
list_for_each_entry(c, &component_list, node)
@@ -377,6 +385,10 @@ void component_del(struct device *dev, const struct 
component_ops *ops)
if (component && component->master)
take_down_master(component->master);
 
+   np = dev->of_node;
+   if (np)
+   np->_flags &= ~OF_DEV_COMPONENT;
+
mutex_unlock(&component_mutex);
 
WARN_ON(!component);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 2b56717..0517b91 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "base.h"
 #include "power/power.h"
@@ -980,6 +981,7 @@ int device_add(struct device *dev)
struct device *parent = NULL;
struct kobject *kobj;
struct class_interface *class_intf;
+   struct device_node *np;
int error = -EINVAL;
 
dev = get_device(dev);
@@ -1088,6 +1090,15 @@ int device_add(struct device *dev)
class_intf->add_dev(dev, class_intf);
mutex_unlock(&dev->class->p->mutex);
}
+
+   /* if DT-created device referenced by phandle, create a component */
+   np = dev->of_node;
+   if (np && np->phandle &&
+   !(np->_flags & OF_DEV_COMPONENT)) {
+   component_add(dev, NULL);
+   np->_flags |= OF_DEV_IMPLICIT_COMPONENT;
+   }
+
 done:
put_device(dev);
return error;
@@ -1189,10 +1200,17 @@ void device_del(struct device *dev)
 {
struct device *parent = dev->parent;
struct class_interface *class_intf;
+   struct device_node *np;
 
/* Notify clients of device removal.  This call must come
 * before dpm_sysfs_remove().
 */
+   np = dev->of_node;
+   if (np && (np->_flags & OF_DEV_COMPONENT)) {
+   component_del(dev, NULL);
+   np->_flags &= ~OF_DEV_IMPLICIT_COMPONENT;
+   }
+
if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
 BUS_NOTIFY_DEL_DEVICE, dev);
diff --git a/include/linux/of.h b/include/linux/of.h
index 70c64ba..40f1c34 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -59,6 +59,8 @@ struct device_node {
struct  proc_dir_entry *pde;/* this node's proc directory */
struct  kref kref;
unsigned long _flags;
+#define OF_DEV_COMPONENT 1
+#define OF_DEV_IMPLICIT_COMPONENT 2
void*data;
 #if defined(CONFIG_SPARC)
const char *path_component_name;
-- 
1.9.rc1

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


[PATCH RFC 1/2] drivers/base: permit base components to omit the bind/unbind ops

2014-02-07 Thread Jean-Francois Moine
Some simple components don't need to do any specific action on
bind to / unbind from a master component.

This patch permits such components to omit the bind/unbind
operations.

Signed-off-by: Jean-Francois Moine 
---
 drivers/base/component.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/base/component.c b/drivers/base/component.c
index c53efe6..0a39d7a 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -225,7 +225,8 @@ static void component_unbind(struct component *component,
 {
WARN_ON(!component->bound);
 
-   component->ops->unbind(component->dev, master->dev, data);
+   if (component->ops)
+   component->ops->unbind(component->dev, master->dev, data);
component->bound = false;
 
/* Release all resources claimed in the binding of this component */
@@ -274,7 +275,11 @@ static int component_bind(struct component *component, 
struct master *master,
dev_dbg(master->dev, "binding %s (ops %ps)\n",
dev_name(component->dev), component->ops);
 
-   ret = component->ops->bind(component->dev, master->dev, data);
+   if (component->ops)
+   ret = component->ops->bind(component->dev, master->dev, data);
+   else
+   ret = 0;
+
if (!ret) {
component->bound = true;
 
-- 
1.9.rc1

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


[PATCH RFC 0/2] drivers/base: simplify simple DT-based components

2014-02-07 Thread Jean-Francois Moine
This patch series tries to simplify the code of simple devices in case
they are part of componentised subsystems, are declared in a DT, and
are not using the component bin/unbind functions.

Jean-Francois Moine (2):
  drivers/base: permit base components to omit the bind/unbind ops
  drivers/base: declare phandle DT nodes as components

 drivers/base/component.c | 21 +++--
 drivers/base/core.c  | 18 ++
 include/linux/of.h   |  2 ++
 3 files changed, 39 insertions(+), 2 deletions(-)

-- 
1.9.rc1

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


[PATCH RFC 2/2] drivers/base: declare phandle DT nodes as components

2014-02-07 Thread Jean-Francois Moine
At system startup time, some devices depends on the availability of
some other devices before starting. The infrastructure for componentised
subsystems permits to handle this dependence, each driver defining
its own role.

This patch does an automatic creation of the lowest components in
case of DT. This permits simple devices to be part of complex
componentised subsystems without any specific code.

When created from DT, the device dependence is generally indicated by
phandle: a device which is pointed to by a phandle must be started
before the pointing device(s).

So, at device register time, the devices which are pointed to by a
phandle are declared as components, except when they declared
themselves as such in their probe function.

Signed-off-by: Jean-Francois Moine 
---
 drivers/base/component.c | 12 
 drivers/base/core.c  | 18 ++
 include/linux/of.h   |  2 ++
 3 files changed, 32 insertions(+)

diff --git a/drivers/base/component.c b/drivers/base/component.c
index 0a39d7a..3cab26b 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 
 struct master {
struct list_head node;
@@ -336,6 +337,7 @@ EXPORT_SYMBOL_GPL(component_bind_all);
 int component_add(struct device *dev, const struct component_ops *ops)
 {
struct component *component;
+   struct device_node *np;
int ret;
 
component = kzalloc(sizeof(*component), GFP_KERNEL);
@@ -356,6 +358,11 @@ int component_add(struct device *dev, const struct 
component_ops *ops)
 
kfree(component);
}
+
+   np = dev->of_node;
+   if (np)
+   np->_flags |= OF_DEV_COMPONENT;
+
mutex_unlock(&component_mutex);
 
return ret < 0 ? ret : 0;
@@ -365,6 +372,7 @@ EXPORT_SYMBOL_GPL(component_add);
 void component_del(struct device *dev, const struct component_ops *ops)
 {
struct component *c, *component = NULL;
+   struct device_node *np;
 
mutex_lock(&component_mutex);
list_for_each_entry(c, &component_list, node)
@@ -377,6 +385,10 @@ void component_del(struct device *dev, const struct 
component_ops *ops)
if (component && component->master)
take_down_master(component->master);
 
+   np = dev->of_node;
+   if (np)
+   np->_flags &= ~OF_DEV_COMPONENT;
+
mutex_unlock(&component_mutex);
 
WARN_ON(!component);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 2b56717..0517b91 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "base.h"
 #include "power/power.h"
@@ -980,6 +981,7 @@ int device_add(struct device *dev)
struct device *parent = NULL;
struct kobject *kobj;
struct class_interface *class_intf;
+   struct device_node *np;
int error = -EINVAL;
 
dev = get_device(dev);
@@ -1088,6 +1090,15 @@ int device_add(struct device *dev)
class_intf->add_dev(dev, class_intf);
mutex_unlock(&dev->class->p->mutex);
}
+
+   /* if DT-created device referenced by phandle, create a component */
+   np = dev->of_node;
+   if (np && np->phandle &&
+   !(np->_flags & OF_DEV_COMPONENT)) {
+   component_add(dev, NULL);
+   np->_flags |= OF_DEV_IMPLICIT_COMPONENT;
+   }
+
 done:
put_device(dev);
return error;
@@ -1189,10 +1200,17 @@ void device_del(struct device *dev)
 {
struct device *parent = dev->parent;
struct class_interface *class_intf;
+   struct device_node *np;
 
/* Notify clients of device removal.  This call must come
 * before dpm_sysfs_remove().
 */
+   np = dev->of_node;
+   if (np && (np->_flags & OF_DEV_COMPONENT)) {
+   component_del(dev, NULL);
+   np->_flags &= ~OF_DEV_IMPLICIT_COMPONENT;
+   }
+
if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
 BUS_NOTIFY_DEL_DEVICE, dev);
diff --git a/include/linux/of.h b/include/linux/of.h
index 70c64ba..40f1c34 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -59,6 +59,8 @@ struct device_node {
struct  proc_dir_entry *pde;/* this node's proc directory */
struct  kref kref;
unsigned long _flags;
+#define OF_DEV_COMPONENT 1
+#define OF_DEV_IMPLICIT_COMPONENT 2
void*data;
 #if defined(CONFIG_SPARC)
const char *path_component_name;
-- 
1.9.rc1

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


[PATCH v3 1/2] drivers/base: permit base components to omit the bind/unbind ops

2014-02-07 Thread Jean-Francois Moine
Some simple components don't need to do any specific action on
bind to / unbind from a master component.

This patch permits such components to omit the bind/unbind
operations.

Signed-off-by: Jean-Francois Moine 
---
 drivers/base/component.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/base/component.c b/drivers/base/component.c
index c53efe6..0a39d7a 100644
--- a/drivers/base/component.c
+++ b/drivers/base/component.c
@@ -225,7 +225,8 @@ static void component_unbind(struct component *component,
 {
WARN_ON(!component->bound);
 
-   component->ops->unbind(component->dev, master->dev, data);
+   if (component->ops)
+   component->ops->unbind(component->dev, master->dev, data);
component->bound = false;
 
/* Release all resources claimed in the binding of this component */
@@ -274,7 +275,11 @@ static int component_bind(struct component *component, 
struct master *master,
dev_dbg(master->dev, "binding %s (ops %ps)\n",
dev_name(component->dev), component->ops);
 
-   ret = component->ops->bind(component->dev, master->dev, data);
+   if (component->ops)
+   ret = component->ops->bind(component->dev, master->dev, data);
+   else
+   ret = 0;
+
if (!ret) {
component->bound = true;
 
-- 
1.9.rc1

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


Re: [PATCH RESEND 3/3] staging: et131x: fix make W=1 build warning

2014-02-07 Thread Greg Kroah-Hartman
On Fri, Feb 07, 2014 at 07:12:50PM +0800, Zhao, Gang wrote:
> Mark, could you look at this patch? It has not been acked.

1 day after sending this you are asking for review?  Please realize that
people are busy and have other things to do.  If after a week or so
there is no response, is it ok to ask about it.  But before that is just
rude.

thanks,

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


RE: [PATCH 01/48] staging: comedi: introduce comedi_timeout()

2014-02-07 Thread Hartley Sweeten
On Friday, February 07, 2014 7:52 AM, Ian Abbott wrote:
> On 2014-02-06 23:48, H Hartley Sweeten wrote:
>> Introduce a comedi core helper function to handle the boilerplate
>> needed by the drivers to wait for a condition to occur. Typically
>> this condition is the analog input/output end-of-conversion used
>> with the comedi (*insn_read) and (*insn_write) operations.
>>
>> To use this function, the drivers just need to provide a callback
>> that checks for the desired condition. The callback should return
>> 0 if the condition is met or -EBUSY if it is still waiting. Any
>> other errno will be returned to the caller. If the timeout occurs
>> before the condition is met -ETIMEDOUT will be returned.
>>
>> The parameters to the callback function are the comedi_device,
>> comedi_subdevice, and comedi_insn pointers that were passed to the
>> (*insn_read) or (*insn_write) as well as an unsigned long, driver
>> specific, 'context' that can be used to pass any other information
>> that might be needed in the callback. This 'context' could be anything
>> such as the register offset to read the status or the bits needed
>> to check the status. The comedi_timeout() function itself does not
>> use any of these parameters.
>>
>> This will help remove all the crazy "wait this many loops" used by
>> some of the drivers. It also creates a common errno for comedi to
>> detect when a timeout occurs.
>>
>> ADC/DAC conversion times are typically pretty fast. A conservative
>> timeout of 1 second (HZ) is used in comedi_timeout().
>
> Perhaps it could be made tunable?  Or at least the 1 second 
> comedi_timeout(blah, blah, blah) could call comedi_timeout_ms(blah, 
> blah, blah, 1000) or whatever.

I think that's a bit overkill. ADC/DAC conversion times are typically just
a couple usecs, at worst msecs. The 1 second timeout should be more
than enough for anything to finish. The timeout could probably be reduced
to something like 500ms and still be safe.

> More comments below


>> +unsigned long timeout = jiffies + msecs_to_jiffies(HZ);
>
> HZ is the number of jiffies in one second, so that should be:
>
>   unsigned long timeout = jiffies + HZ;
>
> or:
>
>   unsigned long timeout = jiffies + msecs_to_jiffies(1000);
>
> (If the time-out is to be made tunable in milliseconds, the second form 
> would be preferred.)

Thanks for pointing that out.

To make the timeout _somewhat_ tunable how about defining this
in comedidev.h:

#define COMEDI_TIMEOUT  1000/* msecs */

Then using the second form above:

unsigned long timeout = jiffies + msecs_to_jiffies(COMEDI_TIMEOUT);

>> +int ret;
>> +
>> +while (time_before(jiffies, timeout)) {
>> +ret = cb(dev, s, insn, context);
>> +if (ret == 0)
>> +return 0;
>
> That test is redundant as 0 != -EBUSY below.

I realize that. But it makes the "success" return more apparent.

>> +if (ret != -EBUSY)
>> +return ret;

And the propagation of non EBUSY errno's.

>> +udelay(1);
>
> It could just do a cpu_relax() instead of udelay(1).

Based on Greg's comments I thought this could also be used in
interrupt contexts but we could not use cpu_relax() then.

Based on your comments, this might not be true. In that case
I agree that cpu_relax() would probably be better.

>> +}
>> +return -ETIMEDOUT;
>> +}
>
> If the function is pre-empted for a long while after calling cb(), the 
> time_before() test could fail without giving the cb() a final chance to 
> return 0.
>
> How about:
>
>   int ret;
>
>   for (;;) {
>   bool going = time_before(jiffies, timeout);
>
>   ret = cb(dev, s, insn, context);
>   if (ret != -EBUSY)
>   return ret;
>   if (!going)
>   return -ETIMEDOUT;
>   cpu_relax();
>   }
>
> (N.B. #include  for cpu_relax().)

Personally I dislike for(;;) loops. Usually they can lead to deadlock
conditions.

The 1 second timeout should be safe even if we are pre-empted. But,
of course, this would need to be tested on a heavily loaded system with
a board that has slower conversion times.

I'll try to gather the data on what the conversion times actually are for
some of the boards. I think I have pulled most of the datasheets for the
drivers currently in comedi.

Regards,
Hartley

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


Re: [PATCH 41/48] staging: comedi: pcl812: use comedi_timeout()

2014-02-07 Thread gre...@linuxfoundation.org
On Fri, Feb 07, 2014 at 04:14:01PM +, Hartley Sweeten wrote:
> On Friday, February 07, 2014 8:34 AM, Ian Abbott wrote:
> > On 2014-02-06 23:49, H Hartley Sweeten wrote:
> >> Use comedi_timeout() to wait for the analog input end-of-conversion.
> >>
> >> Combine the logic for the pcl812 and acl812 end-of-conversion in the
> >> helper function to simplify the driver.
> >>
> >> The interrupt routine also uses the timeout check to make sure data
> >> is actually available. Using NULL here for the 'insn' is safe since
> >> nothing uses it.
> >
> > I don't think you can rely on jiffies being updated in the interrupt 
> > routine.
> 
> From previous comments from Greg I assumed using jiffies for the
> timeout was ok in interrupt contexts, we just couldn't use cpu_relax().
> But, I could be wrong. Hopefully someone might be able to provide
> some more information on this.

Unless you are the timer interrupt, I'm pretty sure that jiffies is ok
to use in interrupt context.  But I could be totally wrong, it's been
years since I looked at that.  Try it and see!  :)

thanks,

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


RE: [PATCH 41/48] staging: comedi: pcl812: use comedi_timeout()

2014-02-07 Thread Hartley Sweeten
On Friday, February 07, 2014 8:34 AM, Ian Abbott wrote:
> On 2014-02-06 23:49, H Hartley Sweeten wrote:
>> Use comedi_timeout() to wait for the analog input end-of-conversion.
>>
>> Combine the logic for the pcl812 and acl812 end-of-conversion in the
>> helper function to simplify the driver.
>>
>> The interrupt routine also uses the timeout check to make sure data
>> is actually available. Using NULL here for the 'insn' is safe since
>> nothing uses it.
>
> I don't think you can rely on jiffies being updated in the interrupt 
> routine.

>From previous comments from Greg I assumed using jiffies for the
timeout was ok in interrupt contexts, we just couldn't use cpu_relax().
But, I could be wrong. Hopefully someone might be able to provide
some more information on this.

For now I can remove all the comedi_timeout() changes that are used
in interrupt contexts. The ones you have pointed out so far are in:

pcl812
pcl816
pcl818
dt2814
das1800

Regards,
Hartley


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


Re: [PATCH 47/48] staging: comedi: move (*insn_{read, write}) timeout debug message to core

2014-02-07 Thread Ian Abbott

On 2014-02-06 23:49, H Hartley Sweeten wrote:

All the comedi drivers that now use comedi_timeout() return a standard
errno when a timeout occurs. Remove all the private debug messages and
have the core output the dev_dbg() message.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/comedi_fops.c  | 11 ++-
  drivers/staging/comedi/drivers/adl_pci9111.c  |  1 -
  drivers/staging/comedi/drivers/adl_pci9118.c  |  1 -
  drivers/staging/comedi/drivers/adv_pci1710.c  |  1 -
  drivers/staging/comedi/drivers/aio_aio12_8.c  |  4 +---
  drivers/staging/comedi/drivers/amplc_pci230.c |  4 +---
  drivers/staging/comedi/drivers/cb_das16_cs.c  |  4 +---
  drivers/staging/comedi/drivers/cb_pcidas64.c  |  4 +---
  drivers/staging/comedi/drivers/das08.c|  4 +---
  drivers/staging/comedi/drivers/das16m1.c  |  4 +---
  drivers/staging/comedi/drivers/das1800.c  |  4 +---
  drivers/staging/comedi/drivers/dt2815.c   | 12 ++--
  drivers/staging/comedi/drivers/dt282x.c   | 12 +++-
  drivers/staging/comedi/drivers/dyna_pci10xx.c |  2 --
  drivers/staging/comedi/drivers/icp_multi.c|  3 ---
  drivers/staging/comedi/drivers/me_daq.c   |  4 +---
  drivers/staging/comedi/drivers/ni_at_a2150.c  |  8 ++--
  drivers/staging/comedi/drivers/ni_daq_700.c   | 16 +---
  drivers/staging/comedi/drivers/pcl812.c   |  8 ++--
  drivers/staging/comedi/drivers/pcl816.c   |  1 -
  drivers/staging/comedi/drivers/pcl818.c   |  1 -
  drivers/staging/comedi/drivers/skel.c |  4 +---
  22 files changed, 29 insertions(+), 84 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index c22c617..302191a 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1194,6 +1194,10 @@ static int parse_insn(struct comedi_device *dev, struct 
comedi_insn *insn,
 switch (insn->insn) {
 case INSN_READ:
 ret = s->insn_read(dev, s, insn, data);
+   if (ret == -ETIMEDOUT) {
+   dev_dbg(dev->class_dev,
+   "read instruction timed out\n");
+   }
 break;
 case INSN_WRITE:
 maxdata = s->maxdata_list
@@ -1207,8 +1211,13 @@ static int parse_insn(struct comedi_device *dev, struct 
comedi_insn *insn,
 break;
 }
 }
-   if (ret == 0)
+   if (ret == 0) {
 ret = s->insn_write(dev, s, insn, data);
+   if (ret == -ETIMEDOUT) {
+   dev_dbg(dev->class_dev,
+   "write instruction timed 
out\n");
+   }
+   }
 break;


It would be nice if those also told you the subdevice number.


 case INSN_BITS:
 if (insn->n != 2) {
diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c 
b/drivers/staging/comedi/drivers/adl_pci9111.c
index c741e8a..647b2d8 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -748,7 +748,6 @@ static int pci9111_ai_insn_read(struct comedi_device *dev,

 ret = comedi_timeout(dev, s, insn, pci9111_ai_eoc, 0);
 if (ret) {
-   comedi_error(dev, "A/D read timeout");
 data[i] = 0;
 pci9111_fifo_reset(dev);
 return ret;
diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index 6492bd8..9218e92 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -614,7 +614,6 @@ static int pci9118_insn_read_ai(struct comedi_device *dev,

 ret = comedi_timeout(dev, s, insn, pci9118_ai_eoc, 0);
 if (ret) {
-   comedi_error(dev, "A/D insn timeout");
 data[n] = 0;
 outl(0, dev->iobase + PCI9118_DELFIFO); /* flush FIFO 
*/
 return ret;
diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 36ed579..16c4bb0 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -467,7 +467,6 @@ static int pci171x_insn_read_ai(struct comedi_device *dev,

 ret = comedi_timeout(dev, s, insn, pci171x_ai_eoc, 0);
 if (ret) {
-   comedi_error(dev, "A/D insn timeout");
 outb(0, dev->io

Re: [PATCH 43/48] staging: comedi: pcl818: use comedi_timeout()

2014-02-07 Thread Ian Abbott

On 2014-02-06 23:49, H Hartley Sweeten wrote:

Use comedi_timeout() to wait for the analog input end-of-conversion.

The interrupt routine also uses the timeout check to make sure data
is actually available. Using NULL here for the 'insn' is safe since
nothing uses it.


Interrupt routine, arrrgh!



Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/drivers/pcl818.c | 56 +
  1 file changed, 29 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl818.c 
b/drivers/staging/comedi/drivers/pcl818.c
index fa1758a..bb51cde 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -336,16 +336,25 @@ static int pcl818_ai_cancel(struct comedi_device *dev,
  static void start_pacer(struct comedi_device *dev, int mode,
unsigned int divisor1, unsigned int divisor2);

-/*
-==
-   ANALOG INPUT MODE0, 818 cards, slow version
-*/
+static int pcl818_ai_eoc(struct comedi_device *dev,
+struct comedi_subdevice *s,
+struct comedi_insn *insn,
+unsigned long context)
+{
+   unsigned int status;
+
+   status = inb(dev->iobase + PCL818_STATUS);
+   if (status & 0x10)
+   return 0;
+   return -EBUSY;
+}
+
  static int pcl818_ai_insn_read(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn, unsigned int *data)
  {
+   int ret;
int n;
-   int timeout;

/* software trigger, DMA and INT off */
outb(0, dev->iobase + PCL818_CONTROL);
@@ -364,18 +373,14 @@ static int pcl818_ai_insn_read(struct comedi_device *dev,
/* start conversion */
outb(0, dev->iobase + PCL818_AD_LO);

-   timeout = 100;
-   while (timeout--) {
-   if (inb(dev->iobase + PCL818_STATUS) & 0x10)
-   goto conv_finish;
-   udelay(1);
+   ret = comedi_timeout(dev, s, insn, pcl818_ai_eoc, 0);
+   if (ret) {
+   comedi_error(dev, "A/D insn timeout");
+   /* clear INT (conversion end) flag */
+   outb(0, dev->iobase + PCL818_CLRINT);
+   return ret;
}
-   comedi_error(dev, "A/D insn timeout");
-   /* clear INT (conversion end) flag */
-   outb(0, dev->iobase + PCL818_CLRINT);
-   return -EIO;

-conv_finish:
data[n] = ((inb(dev->iobase + PCL818_AD_HI) << 4) |
   (inb(dev->iobase + PCL818_AD_LO) >> 4));
}
@@ -463,21 +468,18 @@ static irqreturn_t interrupt_pcl818_ai_mode13_int(int 
irq, void *d)
struct pcl818_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
unsigned char low;
-   int timeout = 50;   /* wait max 50us */
+   int ret;

-   while (timeout--) {
-   if (inb(dev->iobase + PCL818_STATUS) & 0x10)
-   goto conv_finish;
-   udelay(1);
+   ret = comedi_timeout(dev, s, NULL, pcl818_ai_eoc, 0);
+   if (ret) {
+   outb(0, dev->iobase + PCL818_STATUS);/* clear INT 
request */
+   comedi_error(dev, "A/D mode1/3 IRQ without DRDY!");
+   pcl818_ai_cancel(dev, s);
+   s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
+   comedi_event(dev, s);
+   return IRQ_HANDLED;
}
-   outb(0, dev->iobase + PCL818_STATUS);/* clear INT request */
-   comedi_error(dev, "A/D mode1/3 IRQ without DRDY!");
-   pcl818_ai_cancel(dev, s);
-   s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
-   comedi_event(dev, s);
-   return IRQ_HANDLED;

-conv_finish:
low = inb(dev->iobase + PCL818_AD_LO);
comedi_buf_put(s->async, ((inb(dev->iobase + PCL818_AD_HI) << 4) | (low 
>> 4)));  /*  get one sample */
outb(0, dev->iobase + PCL818_CLRINT);/* clear INT request */




--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 41/48] staging: comedi: pcl812: use comedi_timeout()

2014-02-07 Thread Ian Abbott

On 2014-02-06 23:49, H Hartley Sweeten wrote:

Use comedi_timeout() to wait for the analog input end-of-conversion.

Combine the logic for the pcl812 and acl812 end-of-conversion in the
helper function to simplify the driver.

The interrupt routine also uses the timeout check to make sure data
is actually available. Using NULL here for the 'insn' is safe since
nothing uses it.


I don't think you can rely on jiffies being updated in the interrupt 
routine.




Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/drivers/pcl812.c | 95 -
  1 file changed, 45 insertions(+), 50 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl812.c 
b/drivers/staging/comedi/drivers/pcl812.c
index 53613b38..3fa429a 100644
--- a/drivers/staging/comedi/drivers/pcl812.c
+++ b/drivers/staging/comedi/drivers/pcl812.c
@@ -394,16 +394,35 @@ static void setup_range_channel(struct comedi_device *dev,
unsigned int rangechan, char wait);
  static int pcl812_ai_cancel(struct comedi_device *dev,
struct comedi_subdevice *s);
-/*
-==
-*/
+
+static int pcl812_ai_eoc(struct comedi_device *dev,
+struct comedi_subdevice *s,
+struct comedi_insn *insn,
+unsigned long context)
+{
+   struct pcl812_private *devpriv = dev->private;
+   unsigned int status;
+
+   if (devpriv->ai_is16b) {
+   status = inb(dev->iobase + ACL8216_STATUS);
+   if ((status & ACL8216_DRDY) == 0)
+   return 0;
+   } else {
+   status = inb(dev->iobase + PCL812_AD_HI);
+   if ((status & PCL812_DRDY) == 0)
+   return 0;
+   }
+   return -EBUSY;
+}
+
  static int pcl812_ai_insn_read(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn, unsigned int *data)
  {
struct pcl812_private *devpriv = dev->private;
+   int ret = 0;
int n;
-   int timeout, hi;
+   int hi;

/* select software trigger */
outb(devpriv->mode_reg_int | 1, dev->iobase + PCL812_MODE);
@@ -413,33 +432,27 @@ static int pcl812_ai_insn_read(struct comedi_device *dev,
/* start conversion */
outb(255, dev->iobase + PCL812_SOFTTRIG);
udelay(5);
-   timeout = 50;   /* wait max 50us, it must finish under 33us */
-   while (timeout--) {
-   hi = inb(dev->iobase + PCL812_AD_HI);
-   if (!(hi & PCL812_DRDY))
-   goto conv_finish;
-   udelay(1);
+
+   ret = comedi_timeout(dev, s, insn, pcl812_ai_eoc, 0);
+   if (ret) {
+   dev_dbg(dev->class_dev, "A/D insn read timeout\n");
+   break;
}
-   dev_dbg(dev->class_dev, "A/D insn read timeout\n");
-   outb(devpriv->mode_reg_int | 0, dev->iobase + PCL812_MODE);
-   return -ETIME;

-conv_finish:
+   hi = inb(dev->iobase + PCL812_AD_HI);
data[n] = ((hi & 0xf) << 8) | inb(dev->iobase + PCL812_AD_LO);
}
outb(devpriv->mode_reg_int | 0, dev->iobase + PCL812_MODE);
-   return n;
+
+   return ret ? ret : n;
  }

-/*
-==
-*/
  static int acl8216_ai_insn_read(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
  {
+   int ret = 0;
int n;
-   int timeout;

/* select software trigger */
outb(1, dev->iobase + PCL812_MODE);
@@ -449,23 +462,20 @@ static int acl8216_ai_insn_read(struct comedi_device *dev,
/* start conversion */
outb(255, dev->iobase + PCL812_SOFTTRIG);
udelay(5);
-   timeout = 50;   /* wait max 50us, it must finish under 33us */
-   while (timeout--) {
-   if (!(inb(dev->iobase + ACL8216_STATUS) & ACL8216_DRDY))
-   goto conv_finish;
-   udelay(1);
+
+   ret = comedi_timeout(dev, s, insn, pcl812_ai_eoc, 0);
+   if (ret) {
+   dev_dbg(dev->class_dev, "A/D insn read timeout\n");
+   break;
}
-   dev_dbg(dev->class_dev, "A/D insn read timeout\n");
-   outb(0, dev->iobase + PCL812_MODE);
-   return -ETIME;

-conv_finish:
data[n] =
(inb(dev->iobase +
 PCL812_AD_HI) << 8) | inb(dev->iobase + PCL812_AD_L

Re: [PATCH 42/48] staging: comedi: pcl816: use comedi_timeout()

2014-02-07 Thread Ian Abbott

On 2014-02-06 23:49, H Hartley Sweeten wrote:

Use comedi_timeout() to wait for the analog input end-of-conversion.

The interrupt routine also uses the timeout check to make sure data
is actually available. Using NULL here for the 'insn' is safe since
nothing uses it.


No good in interrupt routine, I think.



Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/drivers/pcl816.c | 57 +++--
  1 file changed, 25 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/comedi/drivers/pcl816.c 
b/drivers/staging/comedi/drivers/pcl816.c
index e9d4704..b3a2af3 100644
--- a/drivers/staging/comedi/drivers/pcl816.c
+++ b/drivers/staging/comedi/drivers/pcl816.c
@@ -160,16 +160,25 @@ static int pcl816_ai_cmdtest(struct comedi_device *dev,
 struct comedi_cmd *cmd);
  static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice 
*s);

-/*
-==
-   ANALOG INPUT MODE0, 816 cards, slow version
-*/
+static int pcl816_ai_eoc(struct comedi_device *dev,
+struct comedi_subdevice *s,
+struct comedi_insn *insn,
+unsigned long context)
+{
+   unsigned int status;
+
+   status = inb(dev->iobase + PCL816_STATUS);
+   if ((status & PCL816_STATUS_DRDY_MASK) == 0)
+   return 0;
+   return -EBUSY;
+}
+
  static int pcl816_ai_insn_read(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn, unsigned int *data)
  {
+   int ret;
int n;
-   int timeout;

/*  software trigger, DMA and INT off */
outb(0, dev->iobase + PCL816_CONTROL);
@@ -185,30 +194,20 @@ static int pcl816_ai_insn_read(struct comedi_device *dev,

outb(0, dev->iobase + PCL816_AD_LO); /* start conversion */

-   timeout = 100;
-   while (timeout--) {
-   if (!(inb(dev->iobase + PCL816_STATUS) &
- PCL816_STATUS_DRDY_MASK)) {
-   /*  return read value */
-   data[n] =
-   ((inb(dev->iobase +
- PCL816_AD_HI) << 8) |
-(inb(dev->iobase + PCL816_AD_LO)));
-   /* clear INT (conversion end) flag */
-   outb(0, dev->iobase + PCL816_CLRINT);
-   break;
-   }
-   udelay(1);
-   }
-   /*  Return timeout error */
-   if (!timeout) {
+   ret = comedi_timeout(dev, s, insn, pcl816_ai_eoc, 0);
+   if (ret) {
comedi_error(dev, "A/D insn timeout\n");
data[0] = 0;
/* clear INT (conversion end) flag */
outb(0, dev->iobase + PCL816_CLRINT);
-   return -EIO;
+   return ret;
}

+   /*  return read value */
+   data[n] = ((inb(dev->iobase + PCL816_AD_HI) << 8) |
+ (inb(dev->iobase + PCL816_AD_LO)));
+   /* clear INT (conversion end) flag */
+   outb(0, dev->iobase + PCL816_CLRINT);
}
return n;
  }
@@ -224,22 +223,16 @@ static irqreturn_t interrupt_pcl816_ai_mode13_int(int 
irq, void *d)
struct pcl816_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev;
unsigned char low, hi;
-   int timeout = 50;   /* wait max 50us */
+   int ret;

-   while (timeout--) {
-   if (!(inb(dev->iobase + PCL816_STATUS) &
- PCL816_STATUS_DRDY_MASK))
-   break;
-   udelay(1);
-   }
-   if (!timeout) { /*  timeout, bail error */
+   ret = comedi_timeout(dev, s, NULL, pcl816_ai_eoc, 0);
+   if (ret) {
outb(0, dev->iobase + PCL816_CLRINT);/* clear INT 
request */
comedi_error(dev, "A/D mode1/3 IRQ without DRDY!");
pcl816_ai_cancel(dev, s);
s->async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;
comedi_event(dev, s);
return IRQ_HANDLED;
-
}

/*  get the sample */




--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/6] staging: lustre: Fix typo in sec.c

2014-02-07 Thread Masanari Iida
This patch fixed spelling typos in sec.c

Signed-off-by: Masanari Iida 
---
 drivers/staging/lustre/lustre/ptlrpc/sec.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec.c
index 962b31d..9145dd2 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
@@ -779,7 +779,7 @@ again:
 *   e.g. ptlrpc_abort_inflight();
 */
if (!cli_ctx_is_refreshed(ctx)) {
-   /* timed out or interruptted */
+   /* timed out or interrupted */
req_off_ctx_list(req, ctx);
 
LASSERT(rc != 0);
@@ -805,7 +805,7 @@ void sptlrpc_req_set_flavor(struct ptlrpc_request *req, int 
opcode)
LASSERT(req->rq_cli_ctx->cc_sec);
LASSERT(req->rq_bulk_read == 0 || req->rq_bulk_write == 0);
 
-   /* special security flags accoding to opcode */
+   /* special security flags according to opcode */
switch (opcode) {
case OST_READ:
case MDS_READPAGE:
@@ -1218,7 +1218,7 @@ static void sec_cop_destroy_sec(struct ptlrpc_sec *sec)
LASSERT_ATOMIC_ZERO(&sec->ps_nctx);
LASSERT(policy->sp_cops->destroy_sec);
 
-   CDEBUG(D_SEC, "%s@%p: being destroied\n", sec->ps_policy->sp_name, sec);
+   CDEBUG(D_SEC, "%s@%p: being destroyed\n", sec->ps_policy->sp_name, sec);
 
policy->sp_cops->destroy_sec(sec);
sptlrpc_policy_put(policy);
@@ -1264,7 +1264,7 @@ void sptlrpc_sec_put(struct ptlrpc_sec *sec)
 EXPORT_SYMBOL(sptlrpc_sec_put);
 
 /*
- * policy module is responsible for taking refrence of import
+ * policy module is responsible for taking reference of import
  */
 static
 struct ptlrpc_sec * sptlrpc_sec_create(struct obd_import *imp,
@@ -1419,7 +1419,7 @@ int sptlrpc_import_sec_adapt(struct obd_import *imp,
 
sp = imp->imp_obd->u.cli.cl_sp_me;
} else {
-   /* reverse import, determine flavor from incoming reqeust */
+   /* reverse import, determine flavor from incoming request */
sf = *flvr;
 
if (sf.sf_rpc != SPTLRPC_FLVR_NULL)
@@ -2057,7 +2057,7 @@ int sptlrpc_svc_unwrap_request(struct ptlrpc_request *req)
 
/*
 * if it's not null flavor (which means embedded packing msg),
-* reset the swab mask for the comming inner msg unpacking.
+* reset the swab mask for the coming inner msg unpacking.
 */
if (SPTLRPC_FLVR_POLICY(req->rq_flvr.sf_rpc) != SPTLRPC_POLICY_NULL)
req->rq_req_swab_mask = 0;
@@ -2108,7 +2108,7 @@ int sptlrpc_svc_alloc_rs(struct ptlrpc_request *req, int 
msglen)
 /**
  * Used by ptlrpc server, to perform transformation upon reply message.
  *
- * \post req->rq_reply_off is set to approriate server-controlled reply offset.
+ * \post req->rq_reply_off is set to appropriate server-controlled reply 
offset.
  * \post req->rq_repmsg and req->rq_reply_state->rs_msg becomes inaccessible.
  */
 int sptlrpc_svc_wrap_reply(struct ptlrpc_request *req)
-- 
1.9.rc1

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


[PATCH 1/6] staging: lustre: Fix typo in client.c

2014-02-07 Thread Masanari Iida
This patch fixed spelling typo found in client.c

Signed-off-by: Masanari Iida 
---
 drivers/staging/lustre/lustre/ptlrpc/client.c | 32 +--
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c 
b/drivers/staging/lustre/lustre/ptlrpc/client.c
index d90efe4..eb33bb7 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -62,7 +62,7 @@ void ptlrpc_init_client(int req_portal, int rep_portal, char 
*name,
 EXPORT_SYMBOL(ptlrpc_init_client);
 
 /**
- * Return PortalRPC connection for remore uud \a uuid
+ * Return PortalRPC connection for remote uud \a uuid
  */
 struct ptlrpc_connection *ptlrpc_uuid_to_connection(struct obd_uuid *uuid)
 {
@@ -127,7 +127,7 @@ struct ptlrpc_bulk_desc *ptlrpc_new_bulk(unsigned npages, 
unsigned max_brw,
  * Prepare bulk descriptor for specified outgoing request \a req that
  * can fit \a npages * pages. \a type is bulk type. \a portal is where
  * the bulk to be sent. Used on client-side.
- * Returns pointer to newly allocatrd initialized bulk descriptor or NULL on
+ * Returns pointer to newly allocated initialized bulk descriptor or NULL on
  * error.
  */
 struct ptlrpc_bulk_desc *ptlrpc_prep_bulk_imp(struct ptlrpc_request *req,
@@ -631,7 +631,7 @@ int ptlrpc_request_pack(struct ptlrpc_request *request,
 
/* For some old 1.8 clients (< 1.8.7), they will LASSERT the size of
 * ptlrpc_body sent from server equal to local ptlrpc_body size, so we
-* have to send old ptlrpc_body to keep interoprability with these
+* have to send old ptlrpc_body to keep interoperability with these
 * clients.
 *
 * Only three kinds of server->client RPCs so far:
@@ -639,7 +639,7 @@ int ptlrpc_request_pack(struct ptlrpc_request *request,
 *  - LDLM_CP_CALLBACK
 *  - LDLM_GL_CALLBACK
 *
-* XXX This should be removed whenever we drop the interoprability with
+* XXX This should be removed whenever we drop the interoperability with
 * the these old clients.
 */
if (opcode == LDLM_BL_CALLBACK || opcode == LDLM_CP_CALLBACK ||
@@ -686,7 +686,7 @@ struct ptlrpc_request *__ptlrpc_request_alloc(struct 
obd_import *imp,
 
 /**
  * Helper function for creating a request.
- * Calls __ptlrpc_request_alloc to allocate new request sturcture and inits
+ * Calls __ptlrpc_request_alloc to allocate new request structure and inits
  * buffer structures according to capsule template \a format.
  * Returns allocated request structure pointer or NULL on error.
  */
@@ -743,7 +743,7 @@ void ptlrpc_request_free(struct ptlrpc_request *request)
 EXPORT_SYMBOL(ptlrpc_request_free);
 
 /**
- * Allocate new request for operatione \a opcode and immediatelly pack it for
+ * Allocate new request for operation \a opcode and immediately pack it for
  * network transfer.
  * Only used for simple requests like OBD_PING where the only important
  * part of the request is operation itself.
@@ -768,7 +768,7 @@ struct ptlrpc_request *ptlrpc_request_alloc_pack(struct 
obd_import *imp,
 EXPORT_SYMBOL(ptlrpc_request_alloc_pack);
 
 /**
- * Prepare request (fetched from pool \a poolif not NULL) on import \a imp
+ * Prepare request (fetched from pool \a pool if not NULL) on import \a imp
  * for operation \a opcode. Request would contain \a count buffers.
  * Sizes of buffers are described in array \a lengths and buffers themselves
  * are provided by a pointer \a bufs.
@@ -1073,7 +1073,7 @@ static int ptlrpc_import_delay_req(struct obd_import *imp,
 }
 
 /**
- * Decide if the eror message regarding provided request \a req
+ * Decide if the error message regarding provided request \a req
  * should be printed to the console or not.
  * Makes it's decision on request status and other properties.
  * Returns 1 to print error on the system console or 0 if not.
@@ -1159,7 +1159,7 @@ static void ptlrpc_save_versions(struct ptlrpc_request 
*req)
 /**
  * Callback function called when client receives RPC reply for \a req.
  * Returns 0 on success or error code.
- * The return alue would be assigned to req->rq_status by the caller
+ * The return value would be assigned to req->rq_status by the caller
  * as request processing status.
  * This function also decides if the request needs to be saved for later 
replay.
  */
@@ -2031,7 +2031,7 @@ int ptlrpc_set_next_timeout(struct ptlrpc_request_set 
*set)
 EXPORT_SYMBOL(ptlrpc_set_next_timeout);
 
 /**
- * Send all unset request from the set and then wait untill all
+ * Send all unset request from the set and then wait until all
  * requests in the set complete (either get a reply, timeout, get an
  * error or otherwise be interrupted).
  * Returns 0 on success or error code otherwise.
@@ -2156,7 +2156,7 @@ int ptlrpc_set_wait(struct ptlrpc_request_set *set)
 EXPORT_SYMBOL(ptlrpc_set_wait);
 
 /**
- * Helper fuction for request freeing.
+ * Helper fun

[PATCH 6/6] staging: lustre: Fix typo in lustre/ptlrpc

2014-02-07 Thread Masanari Iida
This patch fixed spelling typo in lustre/ptlrpc.

Signed-off-by: Masanari Iida 
---
 drivers/staging/lustre/lustre/ptlrpc/events.c   | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/import.c   | 4 ++--
 drivers/staging/lustre/lustre/ptlrpc/layout.c   | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 4 ++--
 drivers/staging/lustre/lustre/ptlrpc/niobuf.c   | 4 ++--
 drivers/staging/lustre/lustre/ptlrpc/nrs.c  | 4 ++--
 drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 4 ++--
 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c  | 4 ++--
 drivers/staging/lustre/lustre/ptlrpc/sec_bulk.c | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/sec_config.c   | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/service.c  | 2 +-
 11 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/events.c 
b/drivers/staging/lustre/lustre/ptlrpc/events.c
index f66cfea..6ea0a49 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/events.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/events.c
@@ -545,7 +545,7 @@ int ptlrpc_ni_init(void)
 * different depending on... */
/* kernel LNet calls our master callback when there are new event,
 * because we are guaranteed to get every event via callback,
-* so we just set EQ size to 0 to avoid overhread of serializing
+* so we just set EQ size to 0 to avoid overhead of serializing
 * enqueue/dequeue operations in LNet. */
rc = LNetEQAlloc(0, ptlrpc_master_callback, &ptlrpc_eq_h);
if (rc == 0)
diff --git a/drivers/staging/lustre/lustre/ptlrpc/import.c 
b/drivers/staging/lustre/lustre/ptlrpc/import.c
index f465547..82db0ed 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/import.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/import.c
@@ -1042,7 +1042,7 @@ finish:
if ((ocd->ocd_cksum_types &
 cksum_types_supported_client()) == 0) {
LCONSOLE_WARN("The negotiation of the checksum "
- "alogrithm to use with server %s "
+ "algorithm to use with server %s "
  "failed (%x/%x), disabling "
  "checksums\n",
  obd2cli_tgt(imp->imp_obd),
@@ -1260,7 +1260,7 @@ static int ptlrpc_invalidate_import_thread(void *data)
 /**
  * This is the state machine for client-side recovery on import.
  *
- * Typicaly we have two possibly paths. If we came to server and it is not
+ * Typically we have two possibly paths. If we came to server and it is not
  * in recovery, we just enter IMP_EVICTED state, invalidate our import
  * state and reconnect from scratch.
  * If we came to server that is in recovery, we enter IMP_REPLAY import state.
diff --git a/drivers/staging/lustre/lustre/ptlrpc/layout.c 
b/drivers/staging/lustre/lustre/ptlrpc/layout.c
index dfcb410..9b8f691 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/layout.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/layout.c
@@ -2154,7 +2154,7 @@ EXPORT_SYMBOL(req_capsule_server_sized_swab_get);
  * request (if the caller is executing on the server-side) or reply (if the
  * caller is executing on the client-side).
  *
- * This function convienient for use is code that could be executed on the
+ * This function convenient for use is code that could be executed on the
  * client and server alike.
  */
 const void *req_capsule_other_get(struct req_capsule *pill,
diff --git a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c 
b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
index 1be9786..58f1c8b 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c
@@ -616,7 +616,7 @@ out:
 }
 
 /**
- * The longest valid command string is the maxium policy name size, plus the
+ * The longest valid command string is the maximum policy name size, plus the
  * length of the " reg" substring
  */
 #define LPROCFS_NRS_WR_MAX_CMD (NRS_POL_NAME_MAX + sizeof(" reg") - 1)
@@ -1184,7 +1184,7 @@ int lprocfs_wr_evict_client(struct file *file, const char 
*buffer,
}
tmpbuf = cfs_firststr(kbuf, min_t(unsigned long, BUFLEN - 1, count));
/* Kludge code(deadlock situation): the lprocfs lock has been held
-* since the client is evicted by writting client's
+* since the client is evicted by writing client's
 * uuid/nid to procfs "evict_client" entry. However,
 * obd_export_evict_by_uuid() will call lprocfs_remove() to destroy
 * the proc entries under the being destroyed export{}, so I have
diff --git a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c 
b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
index 3c6bf23..1e94597 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/niobuf.c
@@ -349,7 +34

[PATCH 5/6] staging: lustre: Fix typo in lustre/ptlrpc/gss

2014-02-07 Thread Masanari Iida
This patch fixed spelling typo in comments within
lustre/ptlrpc/gss.

Signed-off-by: Masanari Iida 
---
 drivers/staging/lustre/lustre/ptlrpc/gss/gss_cli_upcall.c | 2 +-
 drivers/staging/lustre/lustre/ptlrpc/gss/gss_keyring.c| 2 +-
 drivers/staging/lustre/lustre/ptlrpc/gss/gss_pipefs.c | 4 ++--
 drivers/staging/lustre/lustre/ptlrpc/gss/gss_svc_upcall.c | 4 ++--
 drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c| 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_cli_upcall.c 
b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_cli_upcall.c
index 55247af..c279edf 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_cli_upcall.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_cli_upcall.c
@@ -336,7 +336,7 @@ int gss_do_ctx_init_rpc(__user char *buffer, unsigned long 
count)
if (rc) {
/* If any _real_ denial be made, we expect server return
 * -EACCES reply or return success but indicate gss error
-* inside reply messsage. All other errors are treated as
+* inside reply message. All other errors are treated as
 * timeout, caller might try the negotiation repeatedly,
 * leave recovery decisions to general ptlrpc layer.
 *
diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_keyring.c 
b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_keyring.c
index d43a13c..4642bbf 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_keyring.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_keyring.c
@@ -1176,7 +1176,7 @@ int gss_kt_instantiate(struct key *key, const void *data, 
size_t datalen)
 
 /*
  * called with key semaphore write locked. it means we can operate
- * on the context without fear of loosing refcount.
+ * on the context without fear of losing refcount.
  */
 static
 int gss_kt_update(struct key *key, const void *data, size_t datalen)
diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_pipefs.c 
b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_pipefs.c
index c624518..7a1ff4f 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_pipefs.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_pipefs.c
@@ -85,7 +85,7 @@ static void gss_sec_pipe_upcall_fini(struct gss_sec *gsec)
 }
 
 /
- * internel context helpers *
+ * internal context helpers *
  /
 
 static
@@ -652,7 +652,7 @@ __u32 mech_name2idx(const char *name)
 
 /* pipefs dentries for each mechanisms */
 static struct dentry *de_pipes[MECH_MAX] = { NULL, };
-/* all upcall messgaes linked here */
+/* all upcall messages linked here */
 static struct list_head upcall_lists[MECH_MAX];
 /* and protected by this */
 static spinlock_t upcall_locks[MECH_MAX];
diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_svc_upcall.c 
b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_svc_upcall.c
index 5b5365b..8d25a70 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/gss/gss_svc_upcall.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/gss/gss_svc_upcall.c
@@ -586,7 +586,7 @@ static int rsc_parse(struct cache_detail *cd, char *mesg, 
int mlen)
goto out;
 
/* currently the expiry time passed down from user-space
-* is invalid, here we retrive it from mech. */
+* is invalid, here we retrieve it from mech. */
if (lgss_inquire_context(rsci.ctx.gsc_mechctx, &ctx_expiry)) {
CERROR("unable to get expire time, drop it\n");
goto out;
@@ -1067,7 +1067,7 @@ int __init gss_init_svc_upcall(void)
 * the init upcall channel, otherwise there's big chance that the first
 * upcall issued before the channel be opened thus nfsv4 cache code will
 * drop the request direclty, thus lead to unnecessary recovery time.
-* here we wait at miximum 1.5 seconds. */
+* here we wait at maximum 1.5 seconds. */
for (i = 0; i < 6; i++) {
if (atomic_read(&rsi_cache.readers) > 0)
break;
diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c 
b/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c
index 42ee331..383601c 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c
@@ -1215,7 +1215,7 @@ int gss_cli_ctx_fini_common(struct ptlrpc_sec *sec,
/*
 * remove UPTODATE flag of reverse ctx thus we won't send fini rpc,
 * this is to avoid potential problems of client side reverse svc ctx
-* be mis-destroyed in various recovery senarios. anyway client can
+* be mis-destroyed in various recovery scenarios. anyway client can
 * manage its reverse ctx well by associating it with its buddy ctx.
 */
if (sec_is_reverse(sec))
-- 
1.9.rc1

__

[PATCH 4/6] staging: lustre: Fix typo in sec_gss.c

2014-02-07 Thread Masanari Iida
This patch fixed spelling typo in comments wihtin sec_gss.c

Signed-off-by: Masanari Iida 
---
 drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c 
b/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c
index 8ce6271..42ee331 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/gss/sec_gss.c
@@ -382,7 +382,7 @@ void gss_cli_ctx_uptodate(struct gss_cli_ctx *gctx)
/* At this point this ctx might have been marked as dead by
 * someone else, in which case nobody will make further use
 * of it. we don't care, and mark it UPTODATE will help
-* destroying server side context when it be destroied. */
+* destroying server side context when it be destroyed. */
set_bit(PTLRPC_CTX_UPTODATE_BIT, &ctx->cc_flags);
 
if (sec_is_reverse(ctx->cc_sec)) {
@@ -676,7 +676,7 @@ redo:
 * lead to the sequence number fall behind the window on server and
 * be dropped. also applies to gss_cli_ctx_seal().
 *
-* Note: null mode dosen't check sequence number. */
+* Note: null mode doesn't check sequence number. */
if (svc != SPTLRPC_SVC_NULL &&
atomic_read(&gctx->gc_seq) - seq > GSS_SEQ_REPACK_THRESHOLD) {
int behind = atomic_read(&gctx->gc_seq) - seq;
@@ -1882,7 +1882,7 @@ int gss_svc_sign(struct ptlrpc_request *req,
 
LASSERT(rs->rs_msg == lustre_msg_buf(rs->rs_repbuf, 1, 0));
 
-   /* embedded lustre_msg might have been shrinked */
+   /* embedded lustre_msg might have been shrunk */
if (req->rq_replen != rs->rs_repbuf->lm_buflens[1])
lustre_shrink_msg(rs->rs_repbuf, 1, req->rq_replen, 1);
 
@@ -2596,7 +2596,7 @@ static int gss_svc_seal(struct ptlrpc_request *req,
int   msglen, rc;
 
/* get clear data length. note embedded lustre_msg might
-* have been shrinked */
+* have been shrunk */
if (req->rq_replen != lustre_msg_buflen(rs->rs_repbuf, 0))
msglen = lustre_shrink_msg(rs->rs_repbuf, 0, req->rq_replen, 1);
else
@@ -2765,7 +2765,7 @@ int gss_copy_rvc_cli_ctx(struct ptlrpc_cli_ctx *cli_ctx,
 * replay.
 *
 * each reverse root ctx will record its latest sequence number on its
-* buddy svcctx before be destroied, so here we continue use it.
+* buddy svcctx before be destroyed, so here we continue use it.
 */
atomic_set(&cli_gctx->gc_seq, svc_gctx->gsc_rvs_seq);
 
@@ -2836,7 +2836,7 @@ int __init sptlrpc_gss_init(void)
if (rc)
goto out_svc_upcall;
 
-   /* register policy after all other stuff be intialized, because it
+   /* register policy after all other stuff be initialized, because it
 * might be in used immediately after the registration. */
 
rc = gss_init_keyring();
-- 
1.9.rc1

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


Re: [PATCH 35/48] staging: comedi: dt2814: use comedi_timeout()

2014-02-07 Thread Ian Abbott

On 2014-02-06 23:49, H Hartley Sweeten wrote:

Use comedi_timeout() to wait for the analog input end-of-conversion.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/drivers/dt2814.c | 44 +++--
  1 file changed, 26 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/comedi/drivers/dt2814.c 
b/drivers/staging/comedi/drivers/dt2814.c
index abad6e4..59c3746 100644
--- a/drivers/staging/comedi/drivers/dt2814.c
+++ b/drivers/staging/comedi/drivers/dt2814.c
@@ -66,26 +66,35 @@ struct dt2814_private {
  #define DT2814_TIMEOUT 10
  #define DT2814_MAX_SPEED 10   /* Arbitrary 10 khz limit */

+static int dt2814_ai_eoc(struct comedi_device *dev,
+struct comedi_subdevice *s,
+struct comedi_insn *insn,
+unsigned long context)
+{
+   unsigned int status;
+
+   status = inb(dev->iobase + DT2814_CSR);
+   if (status & DT2814_FINISH)
+   return 0;
+   return -EBUSY;
+}
+
  static int dt2814_ai_insn_read(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn, unsigned int *data)
  {
-   int n, i, hi, lo;
+   int n, hi, lo;
int chan;
-   int status = 0;
+   int ret;

for (n = 0; n < insn->n; n++) {
chan = CR_CHAN(insn->chanspec);

outb(chan, dev->iobase + DT2814_CSR);
-   for (i = 0; i < DT2814_TIMEOUT; i++) {
-   status = inb(dev->iobase + DT2814_CSR);
-   udelay(10);
-   if (status & DT2814_FINISH)
-   break;
-   }
-   if (i >= DT2814_TIMEOUT)
-   return -ETIMEDOUT;
+
+   ret = comedi_timeout(dev, s, insn, dt2814_ai_eoc, 0);
+   if (ret)
+   return ret;

hi = inb(dev->iobase + DT2814_DATA);
lo = inb(dev->iobase + DT2814_DATA);
@@ -211,16 +220,15 @@ static irqreturn_t dt2814_interrupt(int irq, void *d)
data = (hi << 4) | (lo >> 4);

if (!(--devpriv->ntrig)) {
-   int i;
-
outb(0, dev->iobase + DT2814_CSR);
-   /* note: turning off timed mode triggers another
-  sample. */

-   for (i = 0; i < DT2814_TIMEOUT; i++) {
-   if (inb(dev->iobase + DT2814_CSR) & DT2814_FINISH)
-   break;
-   }
+   /*
+* Note: turning off timed mode triggers another sample.
+* Wait for the conversion to finish then flush the data.
+* We don't have the 'insn' here but it's not needed.
+*/
+   comedi_timeout(dev, s, NULL, dt2814_ai_eoc, 0);
+


I don't think you can't really rely on jiffies being updated while in 
the interrupt routine.



inb(dev->iobase + DT2814_DATA);
inb(dev->iobase + DT2814_DATA);





--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/6] staging: lustre: Fix typo in service.c

2014-02-07 Thread Masanari Iida
This patch fixed spelling typo founx in service.c

Signed-off-by: Masanari Iida 
---
 drivers/staging/lustre/lustre/ptlrpc/service.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c 
b/drivers/staging/lustre/lustre/ptlrpc/service.c
index 590fa8d..cc18a23 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/service.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/service.c
@@ -177,7 +177,7 @@ ptlrpc_grow_req_bufs(struct ptlrpc_service_part *svcpt, int 
post)
 
 /**
  * Part of Rep-Ack logic.
- * Puts a lock and its mode into reply state assotiated to request reply.
+ * Puts a lock and its mode into reply state associated to request reply.
  */
 void
 ptlrpc_save_lock(struct ptlrpc_request *req,
@@ -252,7 +252,7 @@ struct rs_batch {
 static struct ptlrpc_hr_serviceptlrpc_hr;
 
 /**
- * maximum mumber of replies scheduled in one batch
+ * maximum number of replies scheduled in one batch
  */
 #define MAX_SCHEDULED 256
 
@@ -612,7 +612,7 @@ ptlrpc_service_part_init(struct ptlrpc_service *svc,
INIT_LIST_HEAD(&svcpt->scp_hist_reqs);
INIT_LIST_HEAD(&svcpt->scp_hist_rqbds);
 
-   /* acitve requests and hp requests */
+   /* active requests and hp requests */
spin_lock_init(&svcpt->scp_req_lock);
 
/* reply states */
@@ -1982,7 +1982,7 @@ put_conn:
do_gettimeofday(&work_end);
timediff = cfs_timeval_sub(&work_end, &work_start, NULL);
CDEBUG(D_RPCTRACE, "Handled RPC pname:cluuid+ref:pid:xid:nid:opc "
-  "%s:%s+%d:%d:x"LPU64":%s:%d Request procesed in "
+  "%s:%s+%d:%d:x"LPU64":%s:%d Request processed in "
   "%ldus (%ldus total) trans "LPU64" rc %d/%d\n",
current_comm(),
(request->rq_export ?
@@ -2736,7 +2736,7 @@ int ptlrpc_start_thread(struct ptlrpc_service_part 
*svcpt, int wait)
spin_lock(&svcpt->scp_lock);
--svcpt->scp_nthrs_starting;
if (thread_is_stopping(thread)) {
-   /* this ptlrpc_thread is being hanled
+   /* this ptlrpc_thread is being handled
 * by ptlrpc_svcpt_stop_threads now
 */
thread_add_flags(thread, SVC_STOPPED);
-- 
1.9.rc1

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


Re: [PATCH 33/48] staging: comedi: das1800: use comedi_timeout()

2014-02-07 Thread Ian Abbott

On 2014-02-06 23:49, H Hartley Sweeten wrote:

Use comedi_timeout() to wait for the analog input end-of-conversion.

Use break to exit the loop so that the common path can be used to unlock
the spinlock.


I don't think you can rely on jiffies being updated while holding the 
spin-lock with interrupts disabled, so the timeout might not expire.


Probably best to drop this patch for now.



Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/drivers/das1800.c | 33 
  1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das1800.c 
b/drivers/staging/comedi/drivers/das1800.c
index 320d95a..e2022ee 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1194,15 +1194,27 @@ static int das1800_ai_do_cmd(struct comedi_device *dev,
return 0;
  }

-/* read analog input */
+static int das1800_ai_eoc(struct comedi_device *dev,
+ struct comedi_subdevice *s,
+ struct comedi_insn *insn,
+ unsigned long context)
+{
+   unsigned int status;
+
+   status = inb(dev->iobase + DAS1800_STATUS);
+   if (status & FNE)
+   return 0;
+   return -EBUSY;
+}
+
  static int das1800_ai_rinsn(struct comedi_device *dev,
struct comedi_subdevice *s,
struct comedi_insn *insn, unsigned int *data)
  {
const struct das1800_board *thisboard = comedi_board(dev);
-   int i, n;
+   int ret = 0;
+   int n;
int chan, range, aref, chan_range;
-   int timeout = 1000;
unsigned short dpnt;
int conv_flags = 0;
unsigned long irq_flags;
@@ -1237,25 +1249,22 @@ static int das1800_ai_rinsn(struct comedi_device *dev,
for (n = 0; n < insn->n; n++) {
/* trigger conversion */
outb(0, dev->iobase + DAS1800_FIFO);
-   for (i = 0; i < timeout; i++) {
-   if (inb(dev->iobase + DAS1800_STATUS) & FNE)
-   break;
-   }
-   if (i == timeout) {
+
+   ret = comedi_timeout(dev, s, insn, das1800_ai_eoc, 0);
+   if (ret) {
comedi_error(dev, "timeout");
-   n = -ETIME;
-   goto exit;
+   break;
}
+
dpnt = inw(dev->iobase + DAS1800_FIFO);
/* shift data to offset binary for bipolar ranges */
if ((conv_flags & UB) == 0)
dpnt += 1 << (thisboard->resolution - 1);
data[n] = dpnt;
}
-exit:
spin_unlock_irqrestore(&dev->spinlock, irq_flags);

-   return n;
+   return ret ? ret : n;
  }

  /* writes to an analog output channel */




--
-=( Ian Abbott @ MEV Ltd.E-mail: )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587 )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 01/48] staging: comedi: introduce comedi_timeout()

2014-02-07 Thread Ian Abbott

On 2014-02-06 23:48, H Hartley Sweeten wrote:

Introduce a comedi core helper function to handle the boilerplate
needed by the drivers to wait for a condition to occur. Typically
this condition is the analog input/output end-of-conversion used
with the comedi (*insn_read) and (*insn_write) operations.

To use this function, the drivers just need to provide a callback
that checks for the desired condition. The callback should return
0 if the condition is met or -EBUSY if it is still waiting. Any
other errno will be returned to the caller. If the timeout occurs
before the condition is met -ETIMEDOUT will be returned.

The parameters to the callback function are the comedi_device,
comedi_subdevice, and comedi_insn pointers that were passed to the
(*insn_read) or (*insn_write) as well as an unsigned long, driver
specific, 'context' that can be used to pass any other information
that might be needed in the callback. This 'context' could be anything
such as the register offset to read the status or the bits needed
to check the status. The comedi_timeout() function itself does not
use any of these parameters.

This will help remove all the crazy "wait this many loops" used by
some of the drivers. It also creates a common errno for comedi to
detect when a timeout occurs.

ADC/DAC conversion times are typically pretty fast. A conservative
timeout of 1 second (HZ) is used in comedi_timeout().


Perhaps it could be made tunable?  Or at least the 1 second 
comedi_timeout(blah, blah, blah) could call comedi_timeout_ms(blah, 
blah, blah, 1000) or whatever.


More comments below



Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/comedidev.h |  6 ++
  drivers/staging/comedi/drivers.c   | 33 +
  2 files changed, 39 insertions(+)

diff --git a/drivers/staging/comedi/comedidev.h 
b/drivers/staging/comedi/comedidev.h
index f82bd42..d27510c 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -353,6 +353,12 @@ void comedi_buf_memcpy_from(struct comedi_async *async, 
unsigned int offset,

  /* drivers.c - general comedi driver functions */

+int comedi_timeout(struct comedi_device *, struct comedi_subdevice *,
+  struct comedi_insn *,
+  int (*cb)(struct comedi_device *, struct comedi_subdevice *,
+struct comedi_insn *, unsigned long context),
+  unsigned long context);
+
  int comedi_dio_insn_config(struct comedi_device *, struct comedi_subdevice *,
   struct comedi_insn *, unsigned int *data,
   unsigned int mask);
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index 2460803..ceec408 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -18,6 +18,7 @@

  #include 
  #include 
+#include 
  #include 
  #include 
  #include 
@@ -155,6 +156,38 @@ int insn_inval(struct comedi_device *dev, struct 
comedi_subdevice *s,
  }

  /**
+ * comedi_timeout() - wait up to 1 sec for a driver condition to occur.
+ * @dev: comedi_device struct
+ * @s: comedi_subdevice struct
+ * @insn: comedi_insn struct
+ * @cb: callback to check for the condition
+ * @context: private context from the driver
+ */
+int comedi_timeout(struct comedi_device *dev,
+  struct comedi_subdevice *s,
+  struct comedi_insn *insn,
+  int (*cb)(struct comedi_device *dev,
+struct comedi_subdevice *s,
+struct comedi_insn *insn,
+unsigned long context),
+  unsigned long context)
+{
+   unsigned long timeout = jiffies + msecs_to_jiffies(HZ);


HZ is the number of jiffies in one second, so that should be:

unsigned long timeout = jiffies + HZ;

or:

unsigned long timeout = jiffies + msecs_to_jiffies(1000);

(If the time-out is to be made tunable in milliseconds, the second form 
would be preferred.)



+   int ret;
+
+   while (time_before(jiffies, timeout)) {
+   ret = cb(dev, s, insn, context);
+   if (ret == 0)
+   return 0;


That test is redundant as 0 != -EBUSY below.


+   if (ret != -EBUSY)
+   return ret;
+   udelay(1);


It could just do a cpu_relax() instead of udelay(1).


+   }
+   return -ETIMEDOUT;
+}


If the function is pre-empted for a long while after calling cb(), the 
time_before() test could fail without giving the cb() a final chance to 
return 0.


How about:

int ret;

for (;;) {
bool going = time_before(jiffies, timeout);

ret = cb(dev, s, insn, context);
if (ret != -EBUSY)
return ret;
if (!going)
return -ETIMEDOUT;
cpu_rel

Re: [PATCH RFC 26/46] drivers/base: provide an infrastructure for componentised subsystems

2014-02-07 Thread Russell King - ARM Linux
On Fri, Feb 07, 2014 at 12:57:21PM +0100, Jean-Francois Moine wrote:
> I started to use your code (which works fine, thanks), and it avoids a
> lot of problems, especially, about probe_defer in a DT context.
> 
> I was wondering if your componentised mechanism could be extended to the
> devices defined by DT.

It was developed against imx-drm, which is purely DT based.  I already
have a solution for the cubox armada DRM.

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RFC 26/46] drivers/base: provide an infrastructure for componentised subsystems

2014-02-07 Thread Jean-Francois Moine
On Fri, 7 Feb 2014 09:46:56 +
Russell King - ARM Linux  wrote:

> On Fri, Feb 07, 2014 at 10:04:30AM +0100, Daniel Vetter wrote:
> > I've chatted a bit with Hans Verkuil about this topic at fosdem and
> > apparently both v4l and alsa have something like this already in their
> > helper libraries. Adding more people as fyi in case they want to
> > switch to the new driver core stuff from Russell.  
> 
> It's not ALSA, but ASoC which has this.  Mark is already aware of this
> and will be looking at it from an ASoC perspective.

Russell,

I started to use your code (which works fine, thanks), and it avoids a
lot of problems, especially, about probe_defer in a DT context.

I was wondering if your componentised mechanism could be extended to the
devices defined by DT.

In the DT, when a device_node is a phandle, this means it is referenced
by some other device(s), and these device(s) will not start until the
phandle device is registered.

Then, the idea is to do a component_add() for such phandle devices in
device_add() (device_register).

Pratically,

- the component_add() call in device_register would not include any
  bind/unbind callback function, so, this should be tested in
  component_bind/unbind(),

- component_add would not be called if the device being added already
  called component_add in its probe function. A simple flag in the
  struct device_node should solve this problem.

What do you think about this?

-- 
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef |   http://moinejf.free.fr/
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RESEND 3/3] staging: et131x: fix make W=1 build warning

2014-02-07 Thread Mark Einon
On Fri, Feb 07, 2014 at 07:12:50PM +0800, Zhao, Gang wrote:
> Mark, could you look at this patch? It has not been acked.

Sure, in time, I'm making my way through them. Unfortunately kernel
programming is not my day job, and gets done in my spare time (which
is a bit limited at present).

I aim to look at things within in week, but it's usually a good rule
to allow two weeks or so before pinging for a response - that would
probably be a good rule for most kernel developers.

Cheers,

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


Re: [patch 2/2] staging: r8188eu: overflow in rtw_p2p_get_go_device_address()

2014-02-07 Thread Dan Carpenter
On Fri, Feb 07, 2014 at 11:46:26AM +0100, walter harms wrote:
> 
> 
> Am 03.02.2014 23:38, schrieb Dan Carpenter:
> > The go_devadd_str[] array is two characters too small to hold the
> > address so we corrupt memory.
> > 
> > I've changed the user space API slightly and I don't have a way to test
> > if this breaks anything.  In the original code we truncated away the
> > last digit of the address and the NUL terminator so it was already a bit
> > broken.
> > 
> > Signed-off-by: Dan Carpenter 
> > 
> > diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
> > b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> > index dec992569476..4ad80ae1067f 100644
> > --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> > +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> > @@ -3164,9 +3164,7 @@ static int rtw_p2p_get_go_device_address(struct 
> > net_device *dev,
> > u8 *p2pie;
> > uint p2pielen = 0, attr_contentlen = 0;
> > u8 attr_content[100] = {0x00};
> > -
> > -   u8 go_devadd_str[17 + 10] = {0x00};
> > -   /*  +10 is for the str "go_devadd =", we have to clear it at 
> > wrqu->data.pointer */
> > +   u8 go_devadd_str[17 + 12] = {};
> 
> 
> you are deleting the explanation for the magic numbers here,
> - intentionally  ?
> 

Yes.  The old explanation was misleading because the string is
"\n\ndev_add =" and not "go_devadd =".  The buffer is only used in one
location so the size is obvious and there is no need for a comment.

regards,
dan carpenter

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


Re: [PATCH RESEND 3/3] staging: et131x: fix make W=1 build warning

2014-02-07 Thread Zhao, Gang
Mark, could you look at this patch? It has not been acked.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [patch 2/2] staging: r8188eu: overflow in rtw_p2p_get_go_device_address()

2014-02-07 Thread walter harms


Am 03.02.2014 23:38, schrieb Dan Carpenter:
> The go_devadd_str[] array is two characters too small to hold the
> address so we corrupt memory.
> 
> I've changed the user space API slightly and I don't have a way to test
> if this breaks anything.  In the original code we truncated away the
> last digit of the address and the NUL terminator so it was already a bit
> broken.
> 
> Signed-off-by: Dan Carpenter 
> 
> diff --git a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c 
> b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> index dec992569476..4ad80ae1067f 100644
> --- a/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> +++ b/drivers/staging/rtl8188eu/os_dep/ioctl_linux.c
> @@ -3164,9 +3164,7 @@ static int rtw_p2p_get_go_device_address(struct 
> net_device *dev,
>   u8 *p2pie;
>   uint p2pielen = 0, attr_contentlen = 0;
>   u8 attr_content[100] = {0x00};
> -
> - u8 go_devadd_str[17 + 10] = {0x00};
> - /*  +10 is for the str "go_devadd =", we have to clear it at 
> wrqu->data.pointer */
> + u8 go_devadd_str[17 + 12] = {};


you are deleting the explanation for the magic numbers here,
- intentionally  ?

NTL, it would be nice to have a full explanation like
 10= space for  "go_devadd ="
 17= space for attr_content %.2X:%.2X:%.2X:%.2X:%.2X:%.2X
re,
 wh

>   /*  Commented by Albert 20121209 */
>   /*  The input data is the GO's interface address which the 
> application wants to know its device address. */
> @@ -3223,12 +3221,12 @@ static int rtw_p2p_get_go_device_address(struct 
> net_device *dev,
>   spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
>  
>   if (!blnMatch)
> - sprintf(go_devadd_str, "\n\ndev_add = NULL");
> + snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add = 
> NULL");
>   else
> - sprintf(go_devadd_str, "\n\ndev_add 
> =%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
> + snprintf(go_devadd_str, sizeof(go_devadd_str), "\n\ndev_add 
> =%.2X:%.2X:%.2X:%.2X:%.2X:%.2X",
>   attr_content[0], attr_content[1], attr_content[2], 
> attr_content[3], attr_content[4], attr_content[5]);
>  
> - if (copy_to_user(wrqu->data.pointer, go_devadd_str, 10 + 17))
> + if (copy_to_user(wrqu->data.pointer, go_devadd_str, 
> sizeof(go_devadd_str)))
>   return -EFAULT;
>   return ret;
>  }
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RFC 26/46] drivers/base: provide an infrastructure for componentised subsystems

2014-02-07 Thread Russell King - ARM Linux
On Fri, Feb 07, 2014 at 10:04:30AM +0100, Daniel Vetter wrote:
> I've chatted a bit with Hans Verkuil about this topic at fosdem and
> apparently both v4l and alsa have something like this already in their
> helper libraries. Adding more people as fyi in case they want to
> switch to the new driver core stuff from Russell.

It's not ALSA, but ASoC which has this.  Mark is already aware of this
and will be looking at it from an ASoC perspective.

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RFC 26/46] drivers/base: provide an infrastructure for componentised subsystems

2014-02-07 Thread Daniel Vetter
I've chatted a bit with Hans Verkuil about this topic at fosdem and
apparently both v4l and alsa have something like this already in their
helper libraries. Adding more people as fyi in case they want to
switch to the new driver core stuff from Russell.
-Daniel

On Thu, Jan 2, 2014 at 10:27 PM, Russell King
 wrote:
> Subsystems such as ALSA, DRM and others require a single card-level
> device structure to represent a subsystem.  However, firmware tends to
> describe the individual devices and the connections between them.
>
> Therefore, we need a way to gather up the individual component devices
> together, and indicate when we have all the component devices.
>
> We do this in DT by providing a "superdevice" node which specifies
> the components, eg:
>
> imx-drm {
> compatible = "fsl,drm";
> crtcs = <&ipu1>;
> connectors = <&hdmi>;
> };
>
> The superdevice is declared into the component support, along with the
> subcomponents.  The superdevice receives callbacks to locate the
> subcomponents, and identify when all components are present.  At this
> point, we bind the superdevice, which causes the appropriate subsystem
> to be initialised in the conventional way.
>
> When any of the components or superdevice are removed from the system,
> we unbind the superdevice, thereby taking the subsystem down.
>
> Signed-off-by: Russell King 
> ---
>  drivers/base/Makefile |2 +-
>  drivers/base/component.c  |  379 
> +
>  include/linux/component.h |   31 
>  3 files changed, 411 insertions(+), 1 deletions(-)
>  create mode 100644 drivers/base/component.c
>  create mode 100644 include/linux/component.h
>
> diff --git a/drivers/base/Makefile b/drivers/base/Makefile
> index 94e8a80e87f8..870ecfd503af 100644
> --- a/drivers/base/Makefile
> +++ b/drivers/base/Makefile
> @@ -1,6 +1,6 @@
>  # Makefile for the Linux device tree
>
> -obj-y  := core.o bus.o dd.o syscore.o \
> +obj-y  := component.o core.o bus.o dd.o syscore.o \
>driver.o class.o platform.o \
>cpu.o firmware.o init.o map.o devres.o \
>attribute_container.o transport_class.o \
> diff --git a/drivers/base/component.c b/drivers/base/component.c
> new file mode 100644
> index ..5492cd8d2247
> --- /dev/null
> +++ b/drivers/base/component.c
> @@ -0,0 +1,379 @@
> +/*
> + * Componentized device handling.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This is work in progress.  We gather up the component devices into a list,
> + * and bind them when instructed.  At the moment, we're specific to the DRM
> + * subsystem, and only handles one master device, but this doesn't have to be
> + * the case.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +struct master {
> +   struct list_head node;
> +   struct list_head components;
> +   bool bound;
> +
> +   const struct component_master_ops *ops;
> +   struct device *dev;
> +};
> +
> +struct component {
> +   struct list_head node;
> +   struct list_head master_node;
> +   struct master *master;
> +   bool bound;
> +
> +   const struct component_ops *ops;
> +   struct device *dev;
> +};
> +
> +static DEFINE_MUTEX(component_mutex);
> +static LIST_HEAD(component_list);
> +static LIST_HEAD(masters);
> +
> +static struct master *__master_find(struct device *dev, const struct 
> component_master_ops *ops)
> +{
> +   struct master *m;
> +
> +   list_for_each_entry(m, &masters, node)
> +   if (m->dev == dev && (!ops || m->ops == ops))
> +   return m;
> +
> +   return NULL;
> +}
> +
> +/* Attach an unattached component to a master. */
> +static void component_attach_master(struct master *master, struct component 
> *c)
> +{
> +   c->master = master;
> +
> +   list_add_tail(&c->master_node, &master->components);
> +}
> +
> +/* Detach a component from a master. */
> +static void component_detach_master(struct master *master, struct component 
> *c)
> +{
> +   list_del(&c->master_node);
> +
> +   c->master = NULL;
> +}
> +
> +int component_master_add_child(struct master *master,
> +   int (*compare)(struct device *, void *), void *compare_data)
> +{
> +   struct component *c;
> +   int ret = -ENXIO;
> +
> +   list_for_each_entry(c, &component_list, node) {
> +   if (c->master)
> +   continue;
> +
> +   if (compare(c->dev, compare_data)) {
> +   component_attach_master(master, c);
> +   ret = 0;
> +   break;
> +   }
> +   }
> +
> +   ret

Re: [PATCH] et131x: fix allocation failures

2014-02-07 Thread Mark Einon
On Wed, Feb 05, 2014 at 09:56:41PM +0800, Zhao, Gang wrote:
> > @@ -2124,7 +2124,11 @@ static int et131x_rx_dma_memory_alloc(struct 
> > et131x_adapter *adapter)
> >  
> > /* Alloc memory for the lookup table */
> > rx_ring->fbr[0] = kmalloc(sizeof(struct fbr_lookup), GFP_KERNEL);
> > +   if (rx_ring->fbr[0] == NULL)
> > +   return -ENOMEM;
> > rx_ring->fbr[1] = kmalloc(sizeof(struct fbr_lookup), GFP_KERNEL);
> > +   if (rx_ring->fbr[1])
> 
> Hi, I think it should be:
> 
> if (!rx_ring->fbr[1]) {
> kfree(rx_ring->fbr[0]);
> return -ENOMEM;
> }
> 
> The other changes seem good.

Yes, I agree - if this function is going to clear up after itself, there
are a few other allocations further down that also need to handle freeing
already allocated resources, probably using the usual goto style.

Alan, would you like to send an updated patch?

Cheers,

Mark

> 
> > +   return -ENOMEM;
> >  
> > /* The first thing we will do is configure the sizes of the buffer
> >  * rings. These will change based on jumbo packet support.  Larger
> > @@ -2289,7 +2293,7 @@ static void et131x_rx_dma_memory_free(struct 
> > et131x_adapter *adapter)
> > for (id = 0; id < NUM_FBRS; id++) {
> > fbr = rx_ring->fbr[id];
> >  
> > -   if (!fbr->ring_virtaddr)
> > +   if (!fbr || !fbr->ring_virtaddr)
> > continue;
> >  
> > /* First the packet memory */
> > @@ -3591,6 +3595,7 @@ static int et131x_adapter_memory_alloc(struct 
> > et131x_adapter *adapter)
> > if (status) {
> > dev_err(&adapter->pdev->dev,
> >   "et131x_tx_dma_memory_alloc FAILED\n");
> > +   et131x_tx_dma_memory_free(adapter);
> > return status;
> > }
> > /* Receive buffer memory allocation */
> > @@ -3598,7 +3603,7 @@ static int et131x_adapter_memory_alloc(struct 
> > et131x_adapter *adapter)
> > if (status) {
> > dev_err(&adapter->pdev->dev,
> >   "et131x_rx_dma_memory_alloc FAILED\n");
> > -   et131x_tx_dma_memory_free(adapter);
> > +   et131x_adapter_memory_free(adapter);
> > return status;
> > }
> >  
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel