Re: staging: vme_user: accept bus_num of zero

2016-09-19 Thread Aaron Sierra
- Original Message -
> From: "Martyn Welch" 
> Sent: Thursday, September 8, 2016 2:17:35 PM

> On Fri, Sep 02, 2016 at 03:59:45PM -0500, Aaron Sierra wrote:
>> The driver's bus_num parameter is used to select a VME bus during probe.
>> This parameter is used both as a boolean to indicate that probing should
>> occur as well as which bus should be probed. However, the first bus in
>> the system is bus zero, so this method prevents the first bus from being
>> accepted during probe.
>> 
> 
> Umm, no. The array "bus" holds the buses that should be probed, bus_num
> holds the length of the array passed.

Martyn,
Of course you're right about this patch being wrong. I'm sorry for the
noise. I'm not sure how I missed your patch "VME: Provide access to VME
bus enumeration and fix vme_user match function" that addressed my
concern about "bus=0" not working which I raised back in 2013 with my
patch "vme_user: Remove superfluous bus module parameter":

http://www.spinics.net/lists/linux-driver-devel/msg39943.html

-Aaron S

> 
>> This patch changes the default value of bus_num to -1, so that any
>> number in the range of 0 to VME_USER_BUS_MAX will be accepted during
>> probe.
>> 
>> Signed-off-by: Aaron Sierra 
>> ---
>>  drivers/staging/vme/devices/vme_user.c | 9 +
>>  1 file changed, 1 insertion(+), 8 deletions(-)
>> 
>> diff --git a/drivers/staging/vme/devices/vme_user.c
>> b/drivers/staging/vme/devices/vme_user.c
>> index b95883b..fc660bd 100644
>> --- a/drivers/staging/vme/devices/vme_user.c
>> +++ b/drivers/staging/vme/devices/vme_user.c
>> @@ -45,7 +45,7 @@
>>  static const char driver_name[] = "vme_user";
>>  
>>  static int bus[VME_USER_BUS_MAX];
>> -static unsigned int bus_num;
>> +static int bus_num = -1;
>>  
>>  /* Currently Documentation/devices.txt defines the following for VME:
>>   *
>> @@ -735,12 +735,6 @@ static int __init vme_user_init(void)
>>  
>>  pr_info("VME User Space Access Driver\n");
>>  
>> -if (bus_num == 0) {
>> -pr_err("No cards, skipping registration\n");
>> -retval = -ENODEV;
>> -goto err_nocard;
>> -}
>> -
>>  /* Let's start by supporting one bus, we can support more than one
>>   * in future revisions if that ever becomes necessary.
>>   */
>> @@ -763,7 +757,6 @@ static int __init vme_user_init(void)
>>  return retval;
>>  
>>  err_reg:
>> -err_nocard:
>>  return retval;
>>  }
>>  
>> --
>> 1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: staging: vme_user: accept bus_num of zero

2016-09-08 Thread Martyn Welch
On Fri, Sep 02, 2016 at 03:59:45PM -0500, Aaron Sierra wrote:
> The driver's bus_num parameter is used to select a VME bus during probe.
> This parameter is used both as a boolean to indicate that probing should
> occur as well as which bus should be probed. However, the first bus in
> the system is bus zero, so this method prevents the first bus from being
> accepted during probe.
> 

Umm, no. The array "bus" holds the buses that should be probed, bus_num
holds the length of the array passed.

> This patch changes the default value of bus_num to -1, so that any
> number in the range of 0 to VME_USER_BUS_MAX will be accepted during
> probe.
> 
> Signed-off-by: Aaron Sierra 
> ---
>  drivers/staging/vme/devices/vme_user.c | 9 +
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/vme/devices/vme_user.c 
> b/drivers/staging/vme/devices/vme_user.c
> index b95883b..fc660bd 100644
> --- a/drivers/staging/vme/devices/vme_user.c
> +++ b/drivers/staging/vme/devices/vme_user.c
> @@ -45,7 +45,7 @@
>  static const char driver_name[] = "vme_user";
>  
>  static int bus[VME_USER_BUS_MAX];
> -static unsigned int bus_num;
> +static int bus_num = -1;
>  
>  /* Currently Documentation/devices.txt defines the following for VME:
>   *
> @@ -735,12 +735,6 @@ static int __init vme_user_init(void)
>  
>   pr_info("VME User Space Access Driver\n");
>  
> - if (bus_num == 0) {
> - pr_err("No cards, skipping registration\n");
> - retval = -ENODEV;
> - goto err_nocard;
> - }
> -
>   /* Let's start by supporting one bus, we can support more than one
>* in future revisions if that ever becomes necessary.
>*/
> @@ -763,7 +757,6 @@ static int __init vme_user_init(void)
>   return retval;
>  
>  err_reg:
> -err_nocard:
>   return retval;
>  }
>  
> -- 
> 1.9.1
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


staging: vme_user: accept bus_num of zero

2016-09-02 Thread Aaron Sierra
The driver's bus_num parameter is used to select a VME bus during probe.
This parameter is used both as a boolean to indicate that probing should
occur as well as which bus should be probed. However, the first bus in
the system is bus zero, so this method prevents the first bus from being
accepted during probe.

This patch changes the default value of bus_num to -1, so that any
number in the range of 0 to VME_USER_BUS_MAX will be accepted during
probe.

Signed-off-by: Aaron Sierra 
---
 drivers/staging/vme/devices/vme_user.c | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/staging/vme/devices/vme_user.c 
b/drivers/staging/vme/devices/vme_user.c
index b95883b..fc660bd 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -45,7 +45,7 @@
 static const char driver_name[] = "vme_user";
 
 static int bus[VME_USER_BUS_MAX];
-static unsigned int bus_num;
+static int bus_num = -1;
 
 /* Currently Documentation/devices.txt defines the following for VME:
  *
@@ -735,12 +735,6 @@ static int __init vme_user_init(void)
 
pr_info("VME User Space Access Driver\n");
 
-   if (bus_num == 0) {
-   pr_err("No cards, skipping registration\n");
-   retval = -ENODEV;
-   goto err_nocard;
-   }
-
/* Let's start by supporting one bus, we can support more than one
 * in future revisions if that ever becomes necessary.
 */
@@ -763,7 +757,6 @@ static int __init vme_user_init(void)
return retval;
 
 err_reg:
-err_nocard:
return retval;
 }
 
-- 
1.9.1

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