diff mbox

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

Message ID 1392006138-10341-1-git-send-email-shc_work@mail.ru (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Shiyan Feb. 10, 2014, 4:22 a.m. UTC
Driver should be probed from MC13XXX MFD core only, so change
driver declaration to use module_platform_driver_probe().

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/input/misc/mc13783-pwrbutton.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Uwe Kleine-König Feb. 10, 2014, 7:18 a.m. UTC | #1
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@mail.ru>
> ---
>  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
> 
>
diff mbox

Patch

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");