staging: vme_user: accept bus_num of zero

Martyn Welch martyn at welchs.me.uk
Thu Sep 8 19:17:35 UTC 2016


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 <asierra at xes-inc.com>
> ---
>  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
> 


More information about the devel mailing list