Re: [PATCH v4] hwmon/mc13xxx-adc: add support for the MC13892 PMIC

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

 



Hi Uwe,

On Sun, 12 Feb 2012 11:05:34 +0100, Uwe Kleine-König wrote:
> On Sat, Feb 11, 2012 at 09:54:31PM +0100, Jean Delvare wrote:
> > On Sat, 11 Feb 2012 21:15:13 +0100, Uwe Kleine-König wrote:
> > It is OK, but I would at least add a comment in the code to clarify.
> > 
> > That being said, the fix seems to be as simple as moving 3 lines of
> > code out of a conditional, so why not just do that?
>
> Yeah, that and a corresponding change in the error handling and the
> remove callback.
> 
> I will follow up with a patch that introduces the following diff
> compared to v4:

Minor comments below.

> diff --git a/drivers/hwmon/mc13783-adc.c b/drivers/hwmon/mc13783-adc.c
> index e9a7659d..10f18dd 100644
> --- a/drivers/hwmon/mc13783-adc.c
> +++ b/drivers/hwmon/mc13783-adc.c
> @@ -202,12 +202,13 @@ static int __init mc13783_adc_probe(struct platform_device *pdev)
>  		if (ret)
>  			goto out_err_create_16chans;
>  

This leaves an extra blank line.

> -		if (!mc13783_adc_use_touchscreen(pdev)) {
> -			ret = sysfs_create_group(&pdev->dev.kobj,
> -					&mc13783_group_ts);
> -			if (ret)
> -				goto out_err_create_ts;
> -		}
> +	}
> +
> +	if (!mc13783_adc_use_touchscreen(pdev)) {
> +		ret = sysfs_create_group(&pdev->dev.kobj,
> +				&mc13783_group_ts);

Fits on a single line, that's how the original code had it BTW so it
will make your patch shorter.

> +		if (ret)
> +			goto out_err_create_ts;
>  	}
>  
>  	priv->hwmon_dev = hwmon_device_register(&pdev->dev);
> @@ -222,13 +223,12 @@ static int __init mc13783_adc_probe(struct platform_device *pdev)
>  
>  out_err_register:
>  
> -	if (id->driver_data & MC13783_ADC_16CHANS) {
> -		if (!mc13783_adc_use_touchscreen(pdev))
> -			sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_ts);
> +	if (!mc13783_adc_use_touchscreen(pdev))
> +		sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_ts);
>  out_err_create_ts:
>  
> +	if (id->driver_data & MC13783_ADC_16CHANS)
>  		sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_16chans);
> -	}
>  out_err_create_16chans:
>  
>  	sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_base);
> @@ -247,12 +247,11 @@ static int __devexit mc13783_adc_remove(struct platform_device *pdev)
>  
>  	hwmon_device_unregister(priv->hwmon_dev);
>  
> -	if (driver_data & MC13783_ADC_16CHANS) {
> -		if (!mc13783_adc_use_touchscreen(pdev))
> -			sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_ts);
> +	if (!mc13783_adc_use_touchscreen(pdev))
> +		sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_ts);
>  
> +	if (driver_data & MC13783_ADC_16CHANS)
>  		sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_16chans);
> -	}
>  
>  	sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_base);

Rest looks good. No need to resend, I'll adjust it myself.

-- 
Jean Delvare

_______________________________________________
lm-sensors mailing list
lm-sensors@xxxxxxxxxxxxxx
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors



[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux