RE: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-27 Thread Xiubo Li-B47053
> Actually it should even be: > > #define FTM_CSC(channel) \ > (FTM_CSC_BASE + ((channel) * 8)) > Well, yes, It should be, as Sascha has comment about this before, I have already revise it. > > Firstly, we should be clear that the fpc->clk is chip's work clock. > > If so,

Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-27 Thread Thierry Reding
On Mon, Aug 26, 2013 at 07:32:23AM +, Xiubo Li-B47053 wrote: > > > +#define FTM_CSC_BASE0x0C > > > +#define FTM_CSC(_CHANNEL) \ > > > + (FTM_CSC_BASE + (_CHANNEL * 0x08)) > > > > I prefer lowercase variables in macros: > > > > #define FTM_CSC(channel) \ > >

Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-27 Thread Thierry Reding
On Mon, Aug 26, 2013 at 07:32:23AM +, Xiubo Li-B47053 wrote: +#define FTM_CSC_BASE0x0C +#define FTM_CSC(_CHANNEL) \ + (FTM_CSC_BASE + (_CHANNEL * 0x08)) I prefer lowercase variables in macros: #define FTM_CSC(channel) \ (FTM_CSC_BASE + (channel *

RE: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-27 Thread Xiubo Li-B47053
Actually it should even be: #define FTM_CSC(channel) \ (FTM_CSC_BASE + ((channel) * 8)) Well, yes, It should be, as Sascha has comment about this before, I have already revise it. Firstly, we should be clear that the fpc-clk is chip's work clock. If so, after the

RE: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-26 Thread Xiubo Li-B47053
Hi Thierry, See the comments below. > I think the correct capitalizations are: "Freescale", "FTM" and "PWM". > There are other occurrences in the rest of the driver that I haven't > explicitly pointed out. > Yes, that's much better. > > +config PWM_FTM > > Perhaps name this PWM_FSL_FTM to

RE: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-26 Thread Xiubo Li-B47053
Hi Thierry, See the comments below. I think the correct capitalizations are: Freescale, FTM and PWM. There are other occurrences in the rest of the driver that I haven't explicitly pointed out. Yes, that's much better. +config PWM_FTM Perhaps name this PWM_FSL_FTM to match the

Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-23 Thread Thierry Reding
On Wed, Aug 21, 2013 at 11:07:39AM +0800, Xiubo Li wrote: > Add freescale ftm pwm driver support. The ftm pwm device I think the correct capitalizations are: "Freescale", "FTM" and "PWM". There are other occurrences in the rest of the driver that I haven't explicitly pointed out. > diff --git

Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-23 Thread Thierry Reding
On Wed, Aug 21, 2013 at 11:50:49AM +0200, Sascha Hauer wrote: > On Wed, Aug 21, 2013 at 09:24:56AM +, Xiubo Li-B47053 wrote: > > TO Sascha, > > > > > > + > > > > + fpc = to_fsl_chip(chip); > > > > + > > > > + if (WARN_ON(!test_bit(PWMF_REQUESTED, >flags))) > > > > +

Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-23 Thread Thierry Reding
On Wed, Aug 21, 2013 at 11:50:49AM +0200, Sascha Hauer wrote: On Wed, Aug 21, 2013 at 09:24:56AM +, Xiubo Li-B47053 wrote: TO Sascha, + + fpc = to_fsl_chip(chip); + + if (WARN_ON(!test_bit(PWMF_REQUESTED, pwm-flags))) + return -ESHUTDOWN;

Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-23 Thread Thierry Reding
On Wed, Aug 21, 2013 at 11:07:39AM +0800, Xiubo Li wrote: Add freescale ftm pwm driver support. The ftm pwm device I think the correct capitalizations are: Freescale, FTM and PWM. There are other occurrences in the rest of the driver that I haven't explicitly pointed out. diff --git

RE: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-21 Thread Xiubo Li-B47053
TO Sascha, Thanks very much for your quick reply. > > > > + fpc = to_fsl_chip(chip); > > > > + > > > > + if (WARN_ON(!test_bit(PWMF_REQUESTED, >flags))) > > > > + return -ESHUTDOWN; > > > > + > > > > + statename = kasprintf(GFP_KERNEL, "en%d", pwm->hwpwm); > > >

Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-21 Thread Sascha Hauer
On Wed, Aug 21, 2013 at 09:24:56AM +, Xiubo Li-B47053 wrote: > TO Sascha, > > > > + > > > + fpc = to_fsl_chip(chip); > > > + > > > + if (WARN_ON(!test_bit(PWMF_REQUESTED, >flags))) > > > + return -ESHUTDOWN; > > > + > > > + statename = kasprintf(GFP_KERNEL, "en%d", pwm->hwpwm); > > >

RE: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-21 Thread Xiubo Li-B47053
TO Sascha, Thanks very much for your comments. > Subject: Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support > > On Wed, Aug 21, 2013 at 11:07:39AM +0800, Xiubo Li wrote: > > + > > +#define FTM_CSC_BASE0x0C > > +#define FTM_CSC(_CHANNEL) \ > &

Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-21 Thread Sascha Hauer
On Wed, Aug 21, 2013 at 11:07:39AM +0800, Xiubo Li wrote: > + > +#define FTM_CSC_BASE0x0C > +#define FTM_CSC(_CHANNEL) \ > + (FTM_CSC_BASE + (_CHANNEL * 0x08)) I see this more and more in FSL code. This is unsafe! Consider what happens when we call FTM_CSC(1 + 1). The result is

Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-21 Thread Sascha Hauer
On Wed, Aug 21, 2013 at 11:07:39AM +0800, Xiubo Li wrote: + +#define FTM_CSC_BASE0x0C +#define FTM_CSC(_CHANNEL) \ + (FTM_CSC_BASE + (_CHANNEL * 0x08)) I see this more and more in FSL code. This is unsafe! Consider what happens when we call FTM_CSC(1 + 1). The result is certainly

RE: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-21 Thread Xiubo Li-B47053
TO Sascha, Thanks very much for your comments. Subject: Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support On Wed, Aug 21, 2013 at 11:07:39AM +0800, Xiubo Li wrote: + +#define FTM_CSC_BASE0x0C +#define FTM_CSC(_CHANNEL) \ + (FTM_CSC_BASE + (_CHANNEL * 0x08)) I

Re: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-21 Thread Sascha Hauer
On Wed, Aug 21, 2013 at 09:24:56AM +, Xiubo Li-B47053 wrote: TO Sascha, + + fpc = to_fsl_chip(chip); + + if (WARN_ON(!test_bit(PWMF_REQUESTED, pwm-flags))) + return -ESHUTDOWN; + + statename = kasprintf(GFP_KERNEL, en%d, pwm-hwpwm); + pins_state =

RE: [PATCH 1/4] pwm: add freescale ftm pwm driver support

2013-08-21 Thread Xiubo Li-B47053
TO Sascha, Thanks very much for your quick reply. + fpc = to_fsl_chip(chip); + + if (WARN_ON(!test_bit(PWMF_REQUESTED, pwm-flags))) + return -ESHUTDOWN; + + statename = kasprintf(GFP_KERNEL, en%d, pwm-hwpwm); + pins_state =