mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] power: supply: axp288_charger: Use the defined variable to clean code
@ 2021-08-11 10:49 Tang Bin
  2021-08-12 15:20 ` Hans de Goede
  0 siblings, 1 reply; 3+ messages in thread
From: Tang Bin @ 2021-08-11 10:49 UTC (permalink / raw)
  To: sre, wens, hdegoede; +Cc: linux-pm, linux-kernel, Tang Bin, Zhang Shengju

Use the defined variable "dev" to make the code cleaner.

Co-developed-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 drivers/power/supply/axp288_charger.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
index a4df1ea92..b9553be9b 100644
--- a/drivers/power/supply/axp288_charger.c
+++ b/drivers/power/supply/axp288_charger.c
@@ -813,7 +813,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
 	if (val == 0)
 		return -ENODEV;
 
-	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
+	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
 	if (!info)
 		return -ENOMEM;
 
@@ -823,7 +823,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
 
 	info->cable.edev = extcon_get_extcon_dev(AXP288_EXTCON_DEV_NAME);
 	if (info->cable.edev == NULL) {
-		dev_dbg(&pdev->dev, "%s is not ready, probe deferred\n",
+		dev_dbg(dev, "%s is not ready, probe deferred\n",
 			AXP288_EXTCON_DEV_NAME);
 		return -EPROBE_DEFER;
 	}
@@ -834,8 +834,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
 			dev_dbg(dev, "EXTCON_USB_HOST is not ready, probe deferred\n");
 			return -EPROBE_DEFER;
 		}
-		dev_info(&pdev->dev,
-			 "Using " USB_HOST_EXTCON_HID " extcon for usb-id\n");
+		dev_info(dev, "Using " USB_HOST_EXTCON_HID " extcon for usb-id\n");
 	}
 
 	platform_set_drvdata(pdev, info);
@@ -874,7 +873,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
 	INIT_WORK(&info->otg.work, axp288_charger_otg_evt_worker);
 	info->otg.id_nb.notifier_call = axp288_charger_handle_otg_evt;
 	if (info->otg.cable) {
-		ret = devm_extcon_register_notifier(&pdev->dev, info->otg.cable,
+		ret = devm_extcon_register_notifier(dev, info->otg.cable,
 					EXTCON_USB_HOST, &info->otg.id_nb);
 		if (ret) {
 			dev_err(dev, "failed to register EXTCON_USB_HOST notifier\n");
@@ -899,7 +898,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
 					NULL, axp288_charger_irq_thread_handler,
 					IRQF_ONESHOT, info->pdev->name, info);
 		if (ret) {
-			dev_err(&pdev->dev, "failed to request interrupt=%d\n",
+			dev_err(dev, "failed to request interrupt=%d\n",
 								info->irq[i]);
 			return ret;
 		}
-- 
2.20.1.windows.1




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] power: supply: axp288_charger: Use the defined variable to clean code
  2021-08-11 10:49 [PATCH] power: supply: axp288_charger: Use the defined variable to clean code Tang Bin
@ 2021-08-12 15:20 ` Hans de Goede
  2021-08-13 14:32   ` Sebastian Reichel
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2021-08-12 15:20 UTC (permalink / raw)
  To: Tang Bin, sre, wens; +Cc: linux-pm, linux-kernel, Zhang Shengju

Hi,

On 8/11/21 12:49 PM, Tang Bin wrote:
> Use the defined variable "dev" to make the code cleaner.
> 
> Co-developed-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


> ---
>  drivers/power/supply/axp288_charger.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
> index a4df1ea92..b9553be9b 100644
> --- a/drivers/power/supply/axp288_charger.c
> +++ b/drivers/power/supply/axp288_charger.c
> @@ -813,7 +813,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
>  	if (val == 0)
>  		return -ENODEV;
>  
> -	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
> +	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
>  	if (!info)
>  		return -ENOMEM;
>  
> @@ -823,7 +823,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
>  
>  	info->cable.edev = extcon_get_extcon_dev(AXP288_EXTCON_DEV_NAME);
>  	if (info->cable.edev == NULL) {
> -		dev_dbg(&pdev->dev, "%s is not ready, probe deferred\n",
> +		dev_dbg(dev, "%s is not ready, probe deferred\n",
>  			AXP288_EXTCON_DEV_NAME);
>  		return -EPROBE_DEFER;
>  	}
> @@ -834,8 +834,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
>  			dev_dbg(dev, "EXTCON_USB_HOST is not ready, probe deferred\n");
>  			return -EPROBE_DEFER;
>  		}
> -		dev_info(&pdev->dev,
> -			 "Using " USB_HOST_EXTCON_HID " extcon for usb-id\n");
> +		dev_info(dev, "Using " USB_HOST_EXTCON_HID " extcon for usb-id\n");
>  	}
>  
>  	platform_set_drvdata(pdev, info);
> @@ -874,7 +873,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
>  	INIT_WORK(&info->otg.work, axp288_charger_otg_evt_worker);
>  	info->otg.id_nb.notifier_call = axp288_charger_handle_otg_evt;
>  	if (info->otg.cable) {
> -		ret = devm_extcon_register_notifier(&pdev->dev, info->otg.cable,
> +		ret = devm_extcon_register_notifier(dev, info->otg.cable,
>  					EXTCON_USB_HOST, &info->otg.id_nb);
>  		if (ret) {
>  			dev_err(dev, "failed to register EXTCON_USB_HOST notifier\n");
> @@ -899,7 +898,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
>  					NULL, axp288_charger_irq_thread_handler,
>  					IRQF_ONESHOT, info->pdev->name, info);
>  		if (ret) {
> -			dev_err(&pdev->dev, "failed to request interrupt=%d\n",
> +			dev_err(dev, "failed to request interrupt=%d\n",
>  								info->irq[i]);
>  			return ret;
>  		}
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] power: supply: axp288_charger: Use the defined variable to clean code
  2021-08-12 15:20 ` Hans de Goede
@ 2021-08-13 14:32   ` Sebastian Reichel
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2021-08-13 14:32 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Tang Bin, wens, linux-pm, linux-kernel, Zhang Shengju

[-- Attachment #1: Type: text/plain, Size: 2998 bytes --]

Hi,

On Thu, Aug 12, 2021 at 05:20:25PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 8/11/21 12:49 PM, Tang Bin wrote:
> > Use the defined variable "dev" to make the code cleaner.
> > 
> > Co-developed-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> > Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> > Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
> 
> Thanks, patch looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Thanks, queued.

-- Sebastian

> 
> Regards,
> 
> Hans
> 
> 
> > ---
> >  drivers/power/supply/axp288_charger.c | 11 +++++------
> >  1 file changed, 5 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
> > index a4df1ea92..b9553be9b 100644
> > --- a/drivers/power/supply/axp288_charger.c
> > +++ b/drivers/power/supply/axp288_charger.c
> > @@ -813,7 +813,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
> >  	if (val == 0)
> >  		return -ENODEV;
> >  
> > -	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
> > +	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
> >  	if (!info)
> >  		return -ENOMEM;
> >  
> > @@ -823,7 +823,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
> >  
> >  	info->cable.edev = extcon_get_extcon_dev(AXP288_EXTCON_DEV_NAME);
> >  	if (info->cable.edev == NULL) {
> > -		dev_dbg(&pdev->dev, "%s is not ready, probe deferred\n",
> > +		dev_dbg(dev, "%s is not ready, probe deferred\n",
> >  			AXP288_EXTCON_DEV_NAME);
> >  		return -EPROBE_DEFER;
> >  	}
> > @@ -834,8 +834,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
> >  			dev_dbg(dev, "EXTCON_USB_HOST is not ready, probe deferred\n");
> >  			return -EPROBE_DEFER;
> >  		}
> > -		dev_info(&pdev->dev,
> > -			 "Using " USB_HOST_EXTCON_HID " extcon for usb-id\n");
> > +		dev_info(dev, "Using " USB_HOST_EXTCON_HID " extcon for usb-id\n");
> >  	}
> >  
> >  	platform_set_drvdata(pdev, info);
> > @@ -874,7 +873,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
> >  	INIT_WORK(&info->otg.work, axp288_charger_otg_evt_worker);
> >  	info->otg.id_nb.notifier_call = axp288_charger_handle_otg_evt;
> >  	if (info->otg.cable) {
> > -		ret = devm_extcon_register_notifier(&pdev->dev, info->otg.cable,
> > +		ret = devm_extcon_register_notifier(dev, info->otg.cable,
> >  					EXTCON_USB_HOST, &info->otg.id_nb);
> >  		if (ret) {
> >  			dev_err(dev, "failed to register EXTCON_USB_HOST notifier\n");
> > @@ -899,7 +898,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
> >  					NULL, axp288_charger_irq_thread_handler,
> >  					IRQF_ONESHOT, info->pdev->name, info);
> >  		if (ret) {
> > -			dev_err(&pdev->dev, "failed to request interrupt=%d\n",
> > +			dev_err(dev, "failed to request interrupt=%d\n",
> >  								info->irq[i]);
> >  			return ret;
> >  		}
> > 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-13 14:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-11 10:49 [PATCH] power: supply: axp288_charger: Use the defined variable to clean code Tang Bin
2021-08-12 15:20 ` Hans de Goede
2021-08-13 14:32   ` Sebastian Reichel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®