* [PATCH] pwm: pxa: Use driver_data field to store pwm_nr
@ 2013-03-31 16:12 Axel Lin
2013-04-01 7:21 ` Eric Miao
0 siblings, 1 reply; 3+ messages in thread
From: Axel Lin @ 2013-03-31 16:12 UTC (permalink / raw)
To: Thierry Reding; +Cc: Eric Miao, linux-kernel
The driver_data field was used to store information about PWM_ID_BASE and
HAS_SECONDARY_PWM. PWM_ID_BASE is not used now after convert to pwm framework.
This patch stores the pwm_nr in driver_data field to simplify the code.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/pwm/pwm-pxa.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
index b789882..019a8e0 100644
--- a/drivers/pwm/pwm-pxa.c
+++ b/drivers/pwm/pwm-pxa.c
@@ -22,13 +22,10 @@
#include <asm/div64.h>
-#define HAS_SECONDARY_PWM 0x10
-#define PWM_ID_BASE(d) ((d) & 0xf)
-
static const struct platform_device_id pwm_id_table[] = {
- /* PWM has_secondary_pwm? */
- { "pxa25x-pwm", 0 },
- { "pxa27x-pwm", 0 | HAS_SECONDARY_PWM },
+ /* PWM pwm_nr */
+ { "pxa25x-pwm", 1 },
+ { "pxa27x-pwm", 2 },
{ "pxa168-pwm", 1 },
{ "pxa910-pwm", 1 },
{ },
@@ -145,7 +142,7 @@ static int pwm_probe(struct platform_device *pdev)
pwm->chip.dev = &pdev->dev;
pwm->chip.ops = &pxa_pwm_ops;
pwm->chip.base = -1;
- pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
+ pwm->chip.npwm = id->driver_data;
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (r == NULL) {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pwm: pxa: Use driver_data field to store pwm_nr
2013-03-31 16:12 [PATCH] pwm: pxa: Use driver_data field to store pwm_nr Axel Lin
@ 2013-04-01 7:21 ` Eric Miao
2013-04-01 7:34 ` Axel Lin
0 siblings, 1 reply; 3+ messages in thread
From: Eric Miao @ 2013-04-01 7:21 UTC (permalink / raw)
To: Axel Lin; +Cc: Thierry Reding, linux-kernel
On Mon, Apr 1, 2013 at 12:12 AM, Axel Lin <axel.lin@ingics.com> wrote:
> The driver_data field was used to store information about PWM_ID_BASE and
> HAS_SECONDARY_PWM. PWM_ID_BASE is not used now after convert to pwm framework.
> This patch stores the pwm_nr in driver_data field to simplify the code.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/pwm/pwm-pxa.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
> index b789882..019a8e0 100644
> --- a/drivers/pwm/pwm-pxa.c
> +++ b/drivers/pwm/pwm-pxa.c
> @@ -22,13 +22,10 @@
>
> #include <asm/div64.h>
>
> -#define HAS_SECONDARY_PWM 0x10
> -#define PWM_ID_BASE(d) ((d) & 0xf)
> -
> static const struct platform_device_id pwm_id_table[] = {
> - /* PWM has_secondary_pwm? */
> - { "pxa25x-pwm", 0 },
> - { "pxa27x-pwm", 0 | HAS_SECONDARY_PWM },
> + /* PWM pwm_nr */
> + { "pxa25x-pwm", 1 },
> + { "pxa27x-pwm", 2 },
> { "pxa168-pwm", 1 },
> { "pxa910-pwm", 1 },
> { },
> @@ -145,7 +142,7 @@ static int pwm_probe(struct platform_device *pdev)
> pwm->chip.dev = &pdev->dev;
> pwm->chip.ops = &pxa_pwm_ops;
> pwm->chip.base = -1;
> - pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
> + pwm->chip.npwm = id->driver_data;
I'd rather keep the flag for a bit more readability?
>
> r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> if (r == NULL) {
> --
> 1.7.10.4
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pwm: pxa: Use driver_data field to store pwm_nr
2013-04-01 7:21 ` Eric Miao
@ 2013-04-01 7:34 ` Axel Lin
0 siblings, 0 replies; 3+ messages in thread
From: Axel Lin @ 2013-04-01 7:34 UTC (permalink / raw)
To: Eric Miao; +Cc: Thierry Reding, linux-kernel
2013/4/1 Eric Miao <eric.y.miao@gmail.com>:
> On Mon, Apr 1, 2013 at 12:12 AM, Axel Lin <axel.lin@ingics.com> wrote:
>> The driver_data field was used to store information about PWM_ID_BASE and
>> HAS_SECONDARY_PWM. PWM_ID_BASE is not used now after convert to pwm framework.
>> This patch stores the pwm_nr in driver_data field to simplify the code.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>> ---
>> drivers/pwm/pwm-pxa.c | 11 ++++-------
>> 1 file changed, 4 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/pwm/pwm-pxa.c b/drivers/pwm/pwm-pxa.c
>> index b789882..019a8e0 100644
>> --- a/drivers/pwm/pwm-pxa.c
>> +++ b/drivers/pwm/pwm-pxa.c
>> @@ -22,13 +22,10 @@
>>
>> #include <asm/div64.h>
>>
>> -#define HAS_SECONDARY_PWM 0x10
>> -#define PWM_ID_BASE(d) ((d) & 0xf)
>> -
>> static const struct platform_device_id pwm_id_table[] = {
>> - /* PWM has_secondary_pwm? */
>> - { "pxa25x-pwm", 0 },
>> - { "pxa27x-pwm", 0 | HAS_SECONDARY_PWM },
>> + /* PWM pwm_nr */
>> + { "pxa25x-pwm", 1 },
>> + { "pxa27x-pwm", 2 },
>> { "pxa168-pwm", 1 },
>> { "pxa910-pwm", 1 },
>> { },
>> @@ -145,7 +142,7 @@ static int pwm_probe(struct platform_device *pdev)
>> pwm->chip.dev = &pdev->dev;
>> pwm->chip.ops = &pxa_pwm_ops;
>> pwm->chip.base = -1;
>> - pwm->chip.npwm = (id->driver_data & HAS_SECONDARY_PWM) ? 2 : 1;
>> + pwm->chip.npwm = id->driver_data;
>
> I'd rather keep the flag for a bit more readability?
Well, I'd send a patch to just remove PWM_ID_BASE which is not used now.
Regards,
Axel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-01 7:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-31 16:12 [PATCH] pwm: pxa: Use driver_data field to store pwm_nr Axel Lin
2013-04-01 7:21 ` Eric Miao
2013-04-01 7:34 ` Axel Lin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.