Re: [PATCH v2] HID: hiddev: change hiddev_connect() to return bool

2015-10-19 Thread Luis de Bethencourt
On 13/10/15 02:49, Krzysztof Kozlowski wrote:
> 2015-10-09 22:00 GMT+09:00 Luis de Bethencourt <lui...@osg.samsung.com>:
>> Since hid_connect() only cares about hiddev_connect() succeeding or
>> failing, there is no need for this function to return an int and it can
>> return a bool instead.
> 
> It can return bool but it would not be in line with kernel coding
> style. The hiddev_connect() I believe is an action, so "the function
> should return an error-code integer.".
> 
> Best regards,
> Krzysztof
>


Hi Krysztof,

The idea to switch the function to return bool was offered by Jiri Kosina,
as a result of my initial patch changing the return errno code to ENOMEM.

Considering the return isn't propagated by the only consumer of the function,
and your point about returning an integer being the kernel coding style. It
doesn't make sense to change this function.

Thanks for your review!
Luis
 
>>
>> Suggested-by: Jiri Kosina <ji...@kernel.org>
>> Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
>> ---
>>
>> Hi,
>>
>> No idea why my local build did not complain about the obvious mistake
>> on the previous version of the patch.
>>
>> Sorry about that,
>> Luis
>>
>>  drivers/hid/hid-core.c  |  2 +-
>>  drivers/hid/usbhid/hiddev.c | 10 +-
>>  include/linux/hid.h |  2 +-
>>  include/linux/hiddev.h  |  2 +-
>>  4 files changed, 8 insertions(+), 8 deletions(-)

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


[PATCH] HID: hiddev: change hiddev_connect() to return bool

2015-10-09 Thread Luis de Bethencourt
Since hid_connect() only cares about hiddev_connect() succeeding or
failing, there is no need for this function to return an int and it can
return a bool instead.

Suggested-by: Jiri Kosina <ji...@kernel.org>
Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---

Hi,

The suggestion to change the return type of the function was made in:
https://lkml.org/lkml/2015/10/5/330

In relation to hiddev_connect() returning the wrong errno code.

Thanks,
Luis

 drivers/hid/hid-core.c  |  2 +-
 drivers/hid/usbhid/hiddev.c | 10 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index efed99f..a8f3624 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1631,7 +1631,7 @@ int hid_connect(struct hid_device *hdev, unsigned int 
connect_mask)
hdev->claimed |= HID_CLAIMED_INPUT;
 
if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect &&
-   !hdev->hiddev_connect(hdev,
+   hdev->hiddev_connect(hdev,
connect_mask & HID_CONNECT_HIDDEV_FORCE))
hdev->claimed |= HID_CLAIMED_HIDDEV;
if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev))
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 2f1ddca..d715632 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -875,7 +875,7 @@ static struct usb_class_driver hiddev_class = {
 /*
  * This is where hid.c calls us to connect a hid device to the hiddev driver
  */
-int hiddev_connect(struct hid_device *hid, unsigned int force)
+bool hiddev_connect(struct hid_device *hid, unsigned int force)
 {
struct hiddev *hiddev;
struct usbhid_device *usbhid = hid->driver_data;
@@ -890,11 +890,11 @@ int hiddev_connect(struct hid_device *hid, unsigned int 
force)
break;
 
if (i == hid->maxcollection)
-   return -1;
+   return false;
}
 
if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
-   return -1;
+   return false;
 
init_waitqueue_head(>wait);
INIT_LIST_HEAD(>list);
@@ -908,9 +908,9 @@ int hiddev_connect(struct hid_device *hid, unsigned int 
force)
hid_err(hid, "Not able to get a minor for this device\n");
hid->hiddev = NULL;
kfree(hiddev);
-   return -1;
+   return false;
}
-   return 0;
+   return true;
 }
 
 /*
-- 
2.5.1

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


[PATCH v2] HID: hiddev: change hiddev_connect() to return bool

2015-10-09 Thread Luis de Bethencourt
Since hid_connect() only cares about hiddev_connect() succeeding or
failing, there is no need for this function to return an int and it can
return a bool instead.

Suggested-by: Jiri Kosina <ji...@kernel.org>
Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---

Hi,

No idea why my local build did not complain about the obvious mistake
on the previous version of the patch.

Sorry about that,
Luis

 drivers/hid/hid-core.c  |  2 +-
 drivers/hid/usbhid/hiddev.c | 10 +-
 include/linux/hid.h |  2 +-
 include/linux/hiddev.h  |  2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index efed99f..a8f3624 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1631,7 +1631,7 @@ int hid_connect(struct hid_device *hdev, unsigned int 
connect_mask)
hdev->claimed |= HID_CLAIMED_INPUT;
 
if ((connect_mask & HID_CONNECT_HIDDEV) && hdev->hiddev_connect &&
-   !hdev->hiddev_connect(hdev,
+   hdev->hiddev_connect(hdev,
connect_mask & HID_CONNECT_HIDDEV_FORCE))
hdev->claimed |= HID_CLAIMED_HIDDEV;
if ((connect_mask & HID_CONNECT_HIDRAW) && !hidraw_connect(hdev))
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 2f1ddca..d715632 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -875,7 +875,7 @@ static struct usb_class_driver hiddev_class = {
 /*
  * This is where hid.c calls us to connect a hid device to the hiddev driver
  */
-int hiddev_connect(struct hid_device *hid, unsigned int force)
+bool hiddev_connect(struct hid_device *hid, unsigned int force)
 {
struct hiddev *hiddev;
struct usbhid_device *usbhid = hid->driver_data;
@@ -890,11 +890,11 @@ int hiddev_connect(struct hid_device *hid, unsigned int 
force)
break;
 
if (i == hid->maxcollection)
-   return -1;
+   return false;
}
 
if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
-   return -1;
+   return false;
 
init_waitqueue_head(>wait);
INIT_LIST_HEAD(>list);
@@ -908,9 +908,9 @@ int hiddev_connect(struct hid_device *hid, unsigned int 
force)
hid_err(hid, "Not able to get a minor for this device\n");
hid->hiddev = NULL;
kfree(hiddev);
-   return -1;
+   return false;
}
-   return 0;
+   return true;
 }
 
 /*
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 251a1d3..4b5477e 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -547,7 +547,7 @@ struct hid_device { 
/* device report descriptor */
int (*ff_init)(struct hid_device *);
 
/* hiddev event handler */
-   int (*hiddev_connect)(struct hid_device *, unsigned int);
+   bool (*hiddev_connect)(struct hid_device *, unsigned int);
void (*hiddev_disconnect)(struct hid_device *);
void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field,
  struct hid_usage *, __s32);
diff --git a/include/linux/hiddev.h b/include/linux/hiddev.h
index a5dd814..c0f5c25 100644
--- a/include/linux/hiddev.h
+++ b/include/linux/hiddev.h
@@ -38,7 +38,7 @@ struct hid_field;
 struct hid_report;
 
 #ifdef CONFIG_USB_HIDDEV
-int hiddev_connect(struct hid_device *hid, unsigned int force);
+bool hiddev_connect(struct hid_device *hid, unsigned int force);
 void hiddev_disconnect(struct hid_device *);
 void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
  struct hid_usage *usage, __s32 value);
-- 
2.5.1

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


Re: [PATCH] HID: hiddev: fix returned errno code in hiddev_connect()

2015-10-06 Thread Luis de Bethencourt
On 05/10/15 15:24, Jiri Kosina wrote:
> On Sat, 3 Oct 2015, Luis de Bethencourt wrote:
> 
>>> But I am not really sure where you are seeing the bug (mapping to 
>>> -EPERM) in this case? I think the only caller of hiddev_connect() 
>>> should be hid_connect(), and the only thing that guy cares about 
>>> whether individual callbacks succeed or fail, so that it sets 
>>> hdev->clamed flags accordingly.
>>>
>>> Could you please be more specific about the -EPERM mapping you are 
>>> talking about?
>>>
>> I agree with you. The only caller of hiddev_connect() only checks if the
>> callback succeded. It checks if the return < 0.
>> What I meant is that -1 means -EPERM. [0]
> 
> I still don't understand what problem you are chasing here, sorry. EPERM 
> is defined to be 1, yes. So are many other completely unrelated #defines.
> 
>> This patch is purely about the correctness of using -ENOMEM. The word 
>> "propagated" was not the best way to describe this problem. I could edit 
>> the commit message if you would like.
> 
> You seem to imply that someone might be interpreting that -1 as a define 
> from errno.h. But that's not the case.
> 
> Are you going to look at every 'return -1' occurence in the kernel and 
> convert it to something else? That can keep you busy for quite some time:
> 
>   $ git grep 'return -1' | wc -l
>   9167
> 
> The only cleanup I'd imagine at least remotely possible in this case would 
> be to convert the ->connect() callbacks return bool.
> 

This is a very good point. I will write a second version of the patch that
converts the return to a boolean.

Thanks for the review,
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] HID: hiddev: fix returned errno code in hiddev_connect()

2015-10-03 Thread Luis de Bethencourt
On 30/09/15 20:40, Jiri Kosina wrote:
> On Wed, 30 Sep 2015, Luis de Bethencourt wrote:
> 
>> The driver is using -1 instead of the -ENOMEM defined macro to specify
>> that a buffer allocation failed. Since the error number is propagated,
>> the caller will get a -EPERM which is the wrong error condition.
> 
> Generally I agree that the more specific errno, the better.
> 
> But I am not really sure where you are seeing the bug (mapping to -EPERM) 
> in this case? I think the only caller of hiddev_connect() should be 
> hid_connect(), and the only thing that guy cares about whether individual 
> callbacks succeed or fail, so that it sets hdev->clamed flags accordingly.
> 
> Could you please be more specific about the -EPERM mapping you are talking 
> about?
> 
> Thanks,
> 

I agree with you. The only caller of hiddev_connect() only checks if the
callback succeded. It checks if the return < 0.
What I meant is that -1 means -EPERM. [0]

This patch is purely about the correctness of using -ENOMEM. The word
"propagated" was not the best way to describe this problem. I could edit
the commit message if you would like.

Thanks for the review,
Luis

[0] 
http://lxr.free-electrons.com/source/include/uapi/asm-generic/errno-base.h#L15
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] HID: hiddev: fix returned errno code in hiddev_connect()

2015-09-30 Thread Luis de Bethencourt
The driver is using -1 instead of the -ENOMEM defined macro to specify
that a buffer allocation failed. Since the error number is propagated,
the caller will get a -EPERM which is the wrong error condition.

Also, the smatch tool complains with the following warning:
hiddev_connect() warn: returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---
 drivers/hid/usbhid/hiddev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 2f1ddca..c5290ff 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -894,7 +894,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int 
force)
}
 
if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
-   return -1;
+   return -ENOMEM;
 
init_waitqueue_head(>wait);
INIT_LIST_HEAD(>list);
-- 
2.5.1

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


Re: [PATCH] HID: hiddev: fix returned errno code in hiddev_connect()

2015-09-30 Thread Luis de Bethencourt
On 30/09/15 10:52, Luis de Bethencourt wrote:
> The driver is using -1 instead of the -ENOMEM defined macro to specify
> that a buffer allocation failed. Since the error number is propagated,
> the caller will get a -EPERM which is the wrong error condition.
> 
> Also, the smatch tool complains with the following warning:
> hiddev_connect() warn: returning -1 instead of -ENOMEM is sloppy
> 
> Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
> ---
>  drivers/hid/usbhid/hiddev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
> index 2f1ddca..c5290ff 100644
> --- a/drivers/hid/usbhid/hiddev.c
> +++ b/drivers/hid/usbhid/hiddev.c
> @@ -894,7 +894,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int 
> force)
>   }
>  
>   if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
> - return -1;
> + return -ENOMEM;
>  
>   init_waitqueue_head(>wait);
>   INIT_LIST_HEAD(>list);
> 

Hello,

I got an "Undelivered Mail Returned to Sender" from Jiri Kosina's
ji...@kernel.com email address. This email is listed multiple times
in the MAINTAINERS file, does he have a new address to update this
file?

Thanks,
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] HID: hiddev: fix returned errno code in hiddev_connect()

2015-09-30 Thread Luis de Bethencourt
On 30/09/15 11:04, Sudip Mukherjee wrote:
> On Wed, Sep 30, 2015 at 10:56:26AM +0100, Luis de Bethencourt wrote:
>> On 30/09/15 10:52, Luis de Bethencourt wrote:
>>> The driver is using -1 instead of the -ENOMEM defined macro to specify
>>> that a buffer allocation failed. Since the error number is propagated,
>>> the caller will get a -EPERM which is the wrong error condition.
>>>
>>> Also, the smatch tool complains with the following warning:
>>> hiddev_connect() warn: returning -1 instead of -ENOMEM is sloppy
>>>
>>> Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
>>> ---
>>>  drivers/hid/usbhid/hiddev.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
>>> index 2f1ddca..c5290ff 100644
>>> --- a/drivers/hid/usbhid/hiddev.c
>>> +++ b/drivers/hid/usbhid/hiddev.c
>>> @@ -894,7 +894,7 @@ int hiddev_connect(struct hid_device *hid, unsigned int 
>>> force)
>>> }
>>>  
>>> if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
>>> -   return -1;
>>> +   return -ENOMEM;
>>>  
>>> init_waitqueue_head(>wait);
>>> INIT_LIST_HEAD(>list);
>>>
>>
>> Hello,
>>
>> I got an "Undelivered Mail Returned to Sender" from Jiri Kosina's
>> ji...@kernel.com email address. This email is listed multiple times
>> in the MAINTAINERS file, does he have a new address to update this
>> file?
> Its ji...@kernel.org
> 
> regards
> sudip
> 

Hi Sudip,

*facepalm* My mistake, yes.

Sorry,
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: host: fotg210: remove unreachable code

2015-09-28 Thread Luis de Bethencourt
Before running the platform_driver_unregister() the code will either return
retval or jump to clean. Removing this line that is unreachable.

Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---
 drivers/usb/host/fotg210-hcd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c
index 000ed80..64dca2f 100644
--- a/drivers/usb/host/fotg210-hcd.c
+++ b/drivers/usb/host/fotg210-hcd.c
@@ -5932,7 +5932,6 @@ static int __init fotg210_hcd_init(void)
goto clean;
return retval;
 
-   platform_driver_unregister(_hcd_driver);
 clean:
debugfs_remove(fotg210_debug_root);
fotg210_debug_root = NULL;
-- 
2.5.3

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


[PATCH v3 3/4] usb: host: ohci-spear: Fix module autoload for OF platform driver

2015-09-19 Thread Luis de Bethencourt
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---
 drivers/usb/host/ohci-spear.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index 707437c..56478ed 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -161,6 +161,7 @@ static const struct of_device_id spear_ohci_id_table[] = {
{ .compatible = "st,spear600-ohci", },
{ },
 };
+MODULE_DEVICE_TABLE(of, spear_ohci_id_table);
 
 /* Driver definition to register with the platform bus */
 static struct platform_driver spear_ohci_hcd_driver = {
-- 
2.5.1

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


[PATCH v3 4/4] usb: host: uhci-platform: Fix module autoload for OF platform driver

2015-09-19 Thread Luis de Bethencourt
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---
 drivers/usb/host/uhci-platform.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c
index 3a3e3ee..32a6f3d 100644
--- a/drivers/usb/host/uhci-platform.c
+++ b/drivers/usb/host/uhci-platform.c
@@ -140,6 +140,7 @@ static const struct of_device_id platform_uhci_ids[] = {
{ .compatible = "platform-uhci", },
{}
 };
+MODULE_DEVICE_TABLE(of, platform_uhci_ids);
 
 static struct platform_driver uhci_platform_driver = {
.probe  = uhci_hcd_platform_probe,
-- 
2.5.1

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


[PATCH v3 0/4] usb: host: Fix module autoload for OF platform drivers

2015-09-19 Thread Luis de Bethencourt
Hi,

Resending the whole series as Greg asked, and also doing it as a thread
patch series. Sorry for not doing this properly before, I'm learning the
development process. I was using mutt but now I switched to git send-email.
Hopefully procedure will be correct this time.

These patches add the missing MODULE_DEVICE_TABLE() for OF to export
the information so modules have the correct aliases built-in and
autoloading works correctly.

A longer explanation by Javier Canillas can be found here:
https://lkml.org/lkml/2015/7/30/519

Thanks,
Luis

Luis de Bethencourt (4):
  usb: host: ehci-spear: Fix module autoload for OF platform driver
  usb: host: fsl-mph-dr-of: Fix module autoload for OF platform driver
  usb: host: ohci-spear: Fix module autoload for OF platform driver
  usb: host: uhci-platform: Fix module autoload for OF platform driver

 drivers/usb/host/ehci-spear.c| 1 +
 drivers/usb/host/fsl-mph-dr-of.c | 1 +
 drivers/usb/host/ohci-spear.c| 1 +
 drivers/usb/host/uhci-platform.c | 1 +
 4 files changed, 4 insertions(+)

-- 
2.5.1

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


[PATCH v3 2/4] usb: host: fsl-mph-dr-of: Fix module autoload for OF platform driver

2015-09-19 Thread Luis de Bethencourt
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---
 drivers/usb/host/fsl-mph-dr-of.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
index 534c4c5..0c38265 100644
--- a/drivers/usb/host/fsl-mph-dr-of.c
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -351,6 +351,7 @@ static const struct of_device_id fsl_usb2_mph_dr_of_match[] 
= {
 #endif
{},
 };
+MODULE_DEVICE_TABLE(of, fsl_usb2_mph_dr_of_match);
 
 static struct platform_driver fsl_usb2_mph_dr_driver = {
.driver = {
-- 
2.5.1

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


[PATCH v3 1/4] usb: host: ehci-spear: Fix module autoload for OF platform driver

2015-09-19 Thread Luis de Bethencourt
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---
 drivers/usb/host/ehci-spear.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index 34e1474..3c4e525 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -149,6 +149,7 @@ static const struct of_device_id spear_ehci_id_table[] = {
{ .compatible = "st,spear600-ehci", },
{ },
 };
+MODULE_DEVICE_TABLE(of, spear_ehci_id_table);
 
 static struct platform_driver spear_ehci_hcd_driver = {
.probe  = spear_ehci_hcd_drv_probe,
-- 
2.5.1

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


Re: [PATCH 1/4] usb: host: ehci-spear: Fix module autoload for OF platform driver

2015-09-18 Thread Luis de Bethencourt
On Fri, Sep 18, 2015 at 02:57:10PM -0400, Alan Stern wrote:
> On Fri, 18 Sep 2015, Luis de Bethencourt wrote:
> 
> > This platform driver has a OF device ID table but the OF module
> > alias information is not created so module autoloading won't work.
> > 
> > Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
> > ---
> >  drivers/usb/host/ehci-spear.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
> > index 34e1474..be7bcf2 100644
> > --- a/drivers/usb/host/ehci-spear.c
> > +++ b/drivers/usb/host/ehci-spear.c
> > @@ -149,6 +149,7 @@ static const struct of_device_id spear_ehci_id_table[] 
> > = {
> > { .compatible = "st,spear600-ehci", },
> > { },
> >  };
> > +MODULE_DEVICE_TABLE(spear_ehci_id_table);
> 
> Shouldn't this be MODULE_DEVICE_TABLE(of, spear_ehci_id_table)?
> 
> Alan Stern
> 

Hi Alan,

Sorry about this. It looks like I accidentally sent a temporary version of
patch 1/4 and 3/4.

Sending the final and correct version now.

Thanks for the review,
Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/4] usb: host: ehci-spear: Fix module autoload for OF platform driver

2015-09-18 Thread Luis de Bethencourt
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---
 drivers/usb/host/ehci-spear.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index 34e1474..3c4e525 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -149,6 +149,7 @@ static const struct of_device_id spear_ehci_id_table[] = {
{ .compatible = "st,spear600-ehci", },
{ },
 };
+MODULE_DEVICE_TABLE(of, spear_ehci_id_table);
 
 static struct platform_driver spear_ehci_hcd_driver = {
.probe  = spear_ehci_hcd_drv_probe,
-- 
2.4.6

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


[PATCH 0/4] usb: host: Fix module autoload for OF platform drivers

2015-09-18 Thread Luis de Bethencourt
Hi,

These patches add the missing MODULE_DEVICE_TABLE() for OF to export
the information so modules have the correct aliases built-in and
autoloading works correctly.

A longer explanation by Javier Canillas can be found here:
https://lkml.org/lkml/2015/7/30/519

Thanks,
Luis

Luis de Bethencourt (4):
  usb: host: ehci-spear: Fix module autoload for OF platform driver
  usb: host: fsl-mph-dr-of: Fix module autoload for OF platform driver
  usb: host: ohci-spear: Fix module autoload for OF platform driver
  usb: host: uhci-platform: Fix module autoload for OF platform driver

 drivers/usb/host/ehci-spear.c| 1 +
 drivers/usb/host/fsl-mph-dr-of.c | 1 +
 drivers/usb/host/ohci-spear.c| 1 +
 drivers/usb/host/uhci-platform.c | 1 +
 4 files changed, 4 insertions(+)

-- 
2.4.6

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


[PATCH 4/4] usb: host: uhci-platform: Fix module autoload for OF platform driver

2015-09-18 Thread Luis de Bethencourt
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---
 drivers/usb/host/uhci-platform.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/uhci-platform.c b/drivers/usb/host/uhci-platform.c
index 3a3e3ee..32a6f3d 100644
--- a/drivers/usb/host/uhci-platform.c
+++ b/drivers/usb/host/uhci-platform.c
@@ -140,6 +140,7 @@ static const struct of_device_id platform_uhci_ids[] = {
{ .compatible = "platform-uhci", },
{}
 };
+MODULE_DEVICE_TABLE(of, platform_uhci_ids);
 
 static struct platform_driver uhci_platform_driver = {
.probe  = uhci_hcd_platform_probe,
-- 
2.4.6

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


[PATCH 1/4] usb: host: ehci-spear: Fix module autoload for OF platform driver

2015-09-18 Thread Luis de Bethencourt
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---
 drivers/usb/host/ehci-spear.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index 34e1474..be7bcf2 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -149,6 +149,7 @@ static const struct of_device_id spear_ehci_id_table[] = {
{ .compatible = "st,spear600-ehci", },
{ },
 };
+MODULE_DEVICE_TABLE(spear_ehci_id_table);
 
 static struct platform_driver spear_ehci_hcd_driver = {
.probe  = spear_ehci_hcd_drv_probe,
-- 
2.4.6

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


[PATCH 2/4] usb: host: fsl-mph-dr-of: Fix module autoload for OF platform driver

2015-09-18 Thread Luis de Bethencourt
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <lui...@osg.samsung.com>
---
 drivers/usb/host/fsl-mph-dr-of.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
index 534c4c5..0c38265 100644
--- a/drivers/usb/host/fsl-mph-dr-of.c
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -351,6 +351,7 @@ static const struct of_device_id fsl_usb2_mph_dr_of_match[] 
= {
 #endif
{},
 };
+MODULE_DEVICE_TABLE(of, fsl_usb2_mph_dr_of_match);
 
 static struct platform_driver fsl_usb2_mph_dr_driver = {
.driver = {
-- 
2.4.6

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


[PATCH 3/4] usb: host: ohci-spear: Fix module autoload for OF platform driver

2015-09-18 Thread Luis de Bethencourt
Signed-off-by: Luis de Bethencourt <l...@debethencourt.com>
---
 drivers/usb/host/ohci-spear.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index 707437c..56478ed 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -161,6 +161,7 @@ static const struct of_device_id spear_ohci_id_table[] = {
{ .compatible = "st,spear600-ohci", },
{ },
 };
+MODULE_DEVICE_TABLE(of, spear_ohci_id_table);
 
 /* Driver definition to register with the platform bus */
 static struct platform_driver spear_ohci_hcd_driver = {
-- 
2.4.6

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


Re: [PATCH] usb: musb: Fix module autoload for OF platform driver

2015-08-27 Thread Luis de Bethencourt
On Thu, Aug 27, 2015 at 10:41:42AM -0500, Bin Liu wrote:
 Hi,
 
 On Thu, Aug 27, 2015 at 10:07 AM, Luis de Bethencourt
 l...@debethencourt.com wrote:
  This platform driver has a OF device ID table but the OF module
  alias information is not created so module autoloading won't work.
 
 Care to add 'ux500' to the summary line - 'usb: musb: ux500: Fix...'?
 That helps filtering in git-log.
 
 Thanks,
 -Bin.
 

Off course. Sent a second version with 'usb: musb: ux500:' in the commit
subject.

Thanks for reviewing,
Luis

 
  Signed-off-by: Luis de Bethencourt l...@debethencourt.com
  ---
   drivers/usb/musb/ux500.c | 2 ++
   1 file changed, 2 insertions(+)
 
  diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
  index 39168fe..b2685e7 100644
  --- a/drivers/usb/musb/ux500.c
  +++ b/drivers/usb/musb/ux500.c
  @@ -379,6 +379,8 @@ static const struct of_device_id ux500_match[] = {
   {}
   };
 
  +MODULE_DEVICE_TABLE(of, ux500_match);
  +
   static struct platform_driver ux500_driver = {
  .probe  = ux500_probe,
  .remove = ux500_remove,
  --
  2.4.6
 
  --
  To unsubscribe from this list: send the line unsubscribe linux-usb in
  the body of a message to majord...@vger.kernel.org
  More majordomo info at  http://vger.kernel.org/majordomo-info.html
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] usb: musb: ux500: Fix module autoload for OF platform driver

2015-08-27 Thread Luis de Bethencourt
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt l...@debethencourt.com
---
 drivers/usb/musb/ux500.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index 39168fe..b2685e7 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -379,6 +379,8 @@ static const struct of_device_id ux500_match[] = {
 {}
 };
 
+MODULE_DEVICE_TABLE(of, ux500_match);
+
 static struct platform_driver ux500_driver = {
.probe  = ux500_probe,
.remove = ux500_remove,
-- 
2.4.6

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: musb: Fix module autoload for OF platform driver

2015-08-27 Thread Luis de Bethencourt
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt l...@debethencourt.com
---
 drivers/usb/musb/ux500.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index 39168fe..b2685e7 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -379,6 +379,8 @@ static const struct of_device_id ux500_match[] = {
 {}
 };
 
+MODULE_DEVICE_TABLE(of, ux500_match);
+
 static struct platform_driver ux500_driver = {
.probe  = ux500_probe,
.remove = ux500_remove,
-- 
2.4.6

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] usb: host: xhci: remove typo in function documentation

2015-06-30 Thread Luis de Bethencourt
Fix though to through in documentation of xhci_alloc_streams().

Signed-off-by: Luis de Bethencourt l...@debethencourt.com
---
 drivers/usb/host/xhci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 7da0d60..e66857f 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3117,7 +3117,7 @@ static u32 xhci_calculate_no_streams_bitmask(struct 
xhci_hcd *xhci,
 }
 
 /*
- * The USB device drivers use this function (though the HCD interface in USB
+ * The USB device drivers use this function (through the HCD interface in USB
  * core) to prepare a set of bulk endpoints to use streams.  Streams are used 
to
  * coordinate mass storage command queueing across multiple endpoints 
(basically
  * a stream ID == a task ID).
-- 
2.1.4

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html