Re: [PATCH 2/4] input: mc13783: Use module_platform_driver_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 10, 2014 at 08:22:18AM +0400, Alexander Shiyan wrote:
> Driver should be probed from MC13XXX MFD core only, so change
> driver declaration to use module_platform_driver_probe().
That reasoning is broken I think. At least it doesn't mean that a
button-device is only created at boot or module load time. I didn't test
it, but I'd expect that you can unbind/bind the mc13xxx driver via sysfs
and that makes the button support disappear.

(That doesn't necessarily means your change is wrong, just the reason
you provided to justify it is invalid.)

Best regards
Uwe

> Signed-off-by: Alexander Shiyan <shc_work@xxxxxxx>
> ---
>  drivers/input/misc/mc13783-pwrbutton.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c
> index 60be67a..a1e45235 100644
> --- a/drivers/input/misc/mc13783-pwrbutton.c
> +++ b/drivers/input/misc/mc13783-pwrbutton.c
> @@ -88,7 +88,7 @@ static irqreturn_t button_irq(int irq, void *_priv)
>  	return IRQ_HANDLED;
>  }
>  
> -static int mc13783_pwrbutton_probe(struct platform_device *pdev)
> +static int __init mc13xxx_pwrbutton_probe(struct platform_device *pdev)
>  {
>  	const struct mc13xxx_buttons_platform_data *pdata;
>  	struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent);
> @@ -229,7 +229,7 @@ free_input_dev:
>  	return err;
>  }
>  
> -static int mc13783_pwrbutton_remove(struct platform_device *pdev)
> +static int mc13xxx_pwrbutton_remove(struct platform_device *pdev)
>  {
>  	struct mc13783_pwrb *priv = platform_get_drvdata(pdev);
>  	const struct mc13xxx_buttons_platform_data *pdata;
> @@ -253,18 +253,15 @@ static int mc13783_pwrbutton_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static struct platform_driver mc13783_pwrbutton_driver = {
> -	.probe		= mc13783_pwrbutton_probe,
> -	.remove		= mc13783_pwrbutton_remove,
> +static struct platform_driver mc13xxx_pwrbutton_driver = {
>  	.driver		= {
>  		.name	= "mc13783-pwrbutton",
>  		.owner	= THIS_MODULE,
>  	},
> +	.remove		= mc13xxx_pwrbutton_remove,
>  };
> +module_platform_driver_probe(mc13xxx_pwrbutton_driver, mc13xxx_pwrbutton_probe);
>  
> -module_platform_driver(mc13783_pwrbutton_driver);
> -
> -MODULE_ALIAS("platform:mc13783-pwrbutton");
>  MODULE_DESCRIPTION("MC13783 Power Button");
>  MODULE_LICENSE("GPL v2");
>  MODULE_AUTHOR("Philippe Retornaz");
> -- 
> 1.8.3.2
> 
> 

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux