Re: [PATCH 2/3] pwm: Add PWM driver for OMAP using dual-mode timers

2015-12-17 Thread Neil Armstrong
Hi Thierry,
On 12/16/2015 05:27 PM, Thierry Reding wrote:
> I've applied this with some coding style bikeshedding applied. Also I
> think there's a timer leak in the probe function:
Indeed, the coding style had some root for ameliorations ! Thanks !
I also missed this timer leak, thanks for the fix.
>
>> diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
> [...]
>> +static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
>> +{
> [...]
>> +dm_timer = pdata->request_by_node(timer);
>> +if (!dm_timer)
>> +return -EPROBE_DEFER;
>
> dm_timer holds the requested timer now.
>
>> +
>> +omap = devm_kzalloc(>dev, sizeof(*omap), GFP_KERNEL);
>> +if (!omap)
>> +return -ENOMEM;
>
> But it's not released when this allocation fails...
>
>> +
>> +omap->pdata = pdata;
>> +omap->dm_timer = dm_timer;
>> +omap->dm_timer_pdev = of_find_device_by_node(timer);
>> +if (!omap->dm_timer_pdev) {
>> +dev_err(>dev, "Unable to find timer pdev\n");
>> +return -EINVAL;
>> +}
>
> ... nor when this lookup fails. I've taken the liberty of adding two
> calls to omap->pdata->free(dm_timer) to these error paths.
Perfect !

> Please take a look at what's in the pwm/for-next branch to see if it
> still works correctly.
I had a look against my original patch and it should be ok, I will still hook 
it up back
on the real HW in case we forgot something.

> Thanks,
> Thierry
>

Thanks !
Neil




signature.asc
Description: OpenPGP digital signature


Re: [PATCH 2/3] pwm: Add PWM driver for OMAP using dual-mode timers

2015-12-17 Thread Neil Armstrong
Hi Thierry,
On 12/16/2015 05:27 PM, Thierry Reding wrote:
> I've applied this with some coding style bikeshedding applied. Also I
> think there's a timer leak in the probe function:
Indeed, the coding style had some root for ameliorations ! Thanks !
I also missed this timer leak, thanks for the fix.
>
>> diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
> [...]
>> +static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
>> +{
> [...]
>> +dm_timer = pdata->request_by_node(timer);
>> +if (!dm_timer)
>> +return -EPROBE_DEFER;
>
> dm_timer holds the requested timer now.
>
>> +
>> +omap = devm_kzalloc(>dev, sizeof(*omap), GFP_KERNEL);
>> +if (!omap)
>> +return -ENOMEM;
>
> But it's not released when this allocation fails...
>
>> +
>> +omap->pdata = pdata;
>> +omap->dm_timer = dm_timer;
>> +omap->dm_timer_pdev = of_find_device_by_node(timer);
>> +if (!omap->dm_timer_pdev) {
>> +dev_err(>dev, "Unable to find timer pdev\n");
>> +return -EINVAL;
>> +}
>
> ... nor when this lookup fails. I've taken the liberty of adding two
> calls to omap->pdata->free(dm_timer) to these error paths.
Perfect !

> Please take a look at what's in the pwm/for-next branch to see if it
> still works correctly.
I had a look against my original patch and it should be ok, I will still hook 
it up back
on the real HW in case we forgot something.

> Thanks,
> Thierry
>

Thanks !
Neil




signature.asc
Description: OpenPGP digital signature


Re: [PATCH 2/3] pwm: Add PWM driver for OMAP using dual-mode timers

2015-12-16 Thread Thierry Reding
On Mon, Nov 02, 2015 at 12:14:21PM +0100, Neil Armstrong wrote:
> Adds support for using a OMAP dual-mode timer with PWM capability
> as a Linux PWM device. The driver controls the timer by using the
> dmtimer API.
> 
> Add a platform_data structure for each pwm-omap-dmtimer nodes containing
> the dmtimers functions in order to get driver not rely on platform
> specific functions.
> 
> Cc: Grant Erickson 
> Cc: NeilBrown 
> Cc: Joachim Eastwood 
> Suggested-by: Tony Lindgren 
> Signed-off-by: Neil Armstrong 
> ---
>  .../devicetree/bindings/pwm/pwm-omap-dmtimer.txt   |  18 ++
>  drivers/pwm/Kconfig|   9 +
>  drivers/pwm/Makefile   |   1 +
>  drivers/pwm/pwm-omap-dmtimer.c | 322 
> +
>  include/linux/platform_data/pwm_omap_dmtimer.h |  69 +
>  5 files changed, 419 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
>  create mode 100644 drivers/pwm/pwm-omap-dmtimer.c
>  create mode 100644 include/linux/platform_data/pwm_omap_dmtimer.h

I've applied this with some coding style bikeshedding applied. Also I
think there's a timer leak in the probe function:

> diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
[...]
> +static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
> +{
[...]
> + dm_timer = pdata->request_by_node(timer);
> + if (!dm_timer)
> + return -EPROBE_DEFER;

dm_timer holds the requested timer now.

> +
> + omap = devm_kzalloc(>dev, sizeof(*omap), GFP_KERNEL);
> + if (!omap)
> + return -ENOMEM;

But it's not released when this allocation fails...

> +
> + omap->pdata = pdata;
> + omap->dm_timer = dm_timer;
> + omap->dm_timer_pdev = of_find_device_by_node(timer);
> + if (!omap->dm_timer_pdev) {
> + dev_err(>dev, "Unable to find timer pdev\n");
> + return -EINVAL;
> + }

... nor when this lookup fails. I've taken the liberty of adding two
calls to omap->pdata->free(dm_timer) to these error paths.

Please take a look at what's in the pwm/for-next branch to see if it
still works correctly.

Thanks,
Thierry


signature.asc
Description: PGP signature


Re: [PATCH 2/3] pwm: Add PWM driver for OMAP using dual-mode timers

2015-12-16 Thread Thierry Reding
On Mon, Nov 02, 2015 at 12:14:21PM +0100, Neil Armstrong wrote:
> Adds support for using a OMAP dual-mode timer with PWM capability
> as a Linux PWM device. The driver controls the timer by using the
> dmtimer API.
> 
> Add a platform_data structure for each pwm-omap-dmtimer nodes containing
> the dmtimers functions in order to get driver not rely on platform
> specific functions.
> 
> Cc: Grant Erickson 
> Cc: NeilBrown 
> Cc: Joachim Eastwood 
> Suggested-by: Tony Lindgren 
> Signed-off-by: Neil Armstrong 
> ---
>  .../devicetree/bindings/pwm/pwm-omap-dmtimer.txt   |  18 ++
>  drivers/pwm/Kconfig|   9 +
>  drivers/pwm/Makefile   |   1 +
>  drivers/pwm/pwm-omap-dmtimer.c | 322 
> +
>  include/linux/platform_data/pwm_omap_dmtimer.h |  69 +
>  5 files changed, 419 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
>  create mode 100644 drivers/pwm/pwm-omap-dmtimer.c
>  create mode 100644 include/linux/platform_data/pwm_omap_dmtimer.h

I've applied this with some coding style bikeshedding applied. Also I
think there's a timer leak in the probe function:

> diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
[...]
> +static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
> +{
[...]
> + dm_timer = pdata->request_by_node(timer);
> + if (!dm_timer)
> + return -EPROBE_DEFER;

dm_timer holds the requested timer now.

> +
> + omap = devm_kzalloc(>dev, sizeof(*omap), GFP_KERNEL);
> + if (!omap)
> + return -ENOMEM;

But it's not released when this allocation fails...

> +
> + omap->pdata = pdata;
> + omap->dm_timer = dm_timer;
> + omap->dm_timer_pdev = of_find_device_by_node(timer);
> + if (!omap->dm_timer_pdev) {
> + dev_err(>dev, "Unable to find timer pdev\n");
> + return -EINVAL;
> + }

... nor when this lookup fails. I've taken the liberty of adding two
calls to omap->pdata->free(dm_timer) to these error paths.

Please take a look at what's in the pwm/for-next branch to see if it
still works correctly.

Thanks,
Thierry


signature.asc
Description: PGP signature


Re: [PATCH 2/3] pwm: Add PWM driver for OMAP using dual-mode timers

2015-11-30 Thread Tony Lindgren
* Neil Armstrong  [151102 03:14]:
> Adds support for using a OMAP dual-mode timer with PWM capability
> as a Linux PWM device. The driver controls the timer by using the
> dmtimer API.
> 
> Add a platform_data structure for each pwm-omap-dmtimer nodes containing
> the dmtimers functions in order to get driver not rely on platform
> specific functions.
> 
> Cc: Grant Erickson 
> Cc: NeilBrown 
> Cc: Joachim Eastwood 
> Suggested-by: Tony Lindgren 
> Signed-off-by: Neil Armstrong 

This looks good to me:

Acked-by: Tony Lindgren 

Thierry, seems you can pick this driver patch separately if no more
comments, I'll pick up the other two patches in this series.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] pwm: Add PWM driver for OMAP using dual-mode timers

2015-11-30 Thread Tony Lindgren
* Neil Armstrong  [151102 03:14]:
> Adds support for using a OMAP dual-mode timer with PWM capability
> as a Linux PWM device. The driver controls the timer by using the
> dmtimer API.
> 
> Add a platform_data structure for each pwm-omap-dmtimer nodes containing
> the dmtimers functions in order to get driver not rely on platform
> specific functions.
> 
> Cc: Grant Erickson 
> Cc: NeilBrown 
> Cc: Joachim Eastwood 
> Suggested-by: Tony Lindgren 
> Signed-off-by: Neil Armstrong 

This looks good to me:

Acked-by: Tony Lindgren 

Thierry, seems you can pick this driver patch separately if no more
comments, I'll pick up the other two patches in this series.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/