Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1351829

Re: [PATCH v2] parport: register driver later

From Ross Zwisler <ross.zwisler@linux.intel.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] parport: register driver later
Date 2016-03-07 18:40 +0100
Message-ID <ra7iq-5Vi-17@gated-at.bofh.it> (permalink)
References <r9IDo-6Jh-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Mar 06, 2016 at 08:40:10PM +0530, Sudip Mukherjee wrote:
> If the parport bus is not yet registered and any device using parallel
> port tries to register with the bus we get a stackdump with a message
> of Kernel bug.
> 
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> Cc: <stable@vger.kernel.org> # 4.2+
> Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk>
> ---
> 
> Hi Ross,
> Can you please test this patch in your setup. This is a respin of the
> previous patch in another way.

Yep, this also solves the issue for me.

Tested-by: Ross Zwisler <ross.zwisler@linux.intel.com>

>  drivers/parport/share.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/parport/share.c b/drivers/parport/share.c
> index 3308427..c1eba80 100644
> --- a/drivers/parport/share.c
> +++ b/drivers/parport/share.c
> @@ -135,9 +135,18 @@ static struct bus_type parport_bus_type = {
>  	.probe = parport_probe,
>  };
>  
> +static bool is_registered;
> +
>  int parport_bus_init(void)
>  {
> -	return bus_register(&parport_bus_type);
> +	int ret;
> +
> +	ret = bus_register(&parport_bus_type);
> +	if (ret)
> +		return ret;
> +
> +	is_registered = true;
> +	return 0;
>  }
>  
>  void parport_bus_exit(void)
> @@ -273,6 +282,9 @@ int __parport_register_driver(struct parport_driver *drv, struct module *owner,
>  		/* using device model */
>  		int ret;
>  
> +		if (!is_registered)
> +			return -EAGAIN;
> +
>  		/* initialize common driver fields */
>  		drv->driver.name = drv->name;
>  		drv->driver.bus = &parport_bus_type;
> -- 
> 1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v2] parport: register driver later Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-03-06 16:20 +0100
  Re: [PATCH v2] parport: register driver later Ross Zwisler <ross.zwisler@linux.intel.com> - 2016-03-07 18:40 +0100

csiph-web