All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
@ 2021-10-24 10:33 Maíra Canal
  2021-10-25  6:08 ` Uwe Kleine-König
  2021-10-27  6:07   ` kernel test robot
  0 siblings, 2 replies; 13+ messages in thread
From: Maíra Canal @ 2021-10-24 10:33 UTC (permalink / raw)
  To: sean, mchehab, thierry.reding, u.kleine-koenig, lee.jones
  Cc: linux-media, linux-kernel, linux-pwm

Remove legacy PWM interface (pwm_config, pwm_enable, pwm_disable) and
replace it for the atomic PWM API.

Signed-off-by: Maíra Canal <maira.canal@usp.br>
---
V1 -> V2: Assign variables directly and simplify conditional statement
V2 -> V3: Fix declaration of undeclared variable
---
 drivers/media/rc/pwm-ir-tx.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/rc/pwm-ir-tx.c b/drivers/media/rc/pwm-ir-tx.c
index 4bc28d2c9cc9..e1f348a962e8 100644
--- a/drivers/media/rc/pwm-ir-tx.c
+++ b/drivers/media/rc/pwm-ir-tx.c
@@ -53,22 +53,21 @@ static int pwm_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
 {
 	struct pwm_ir *pwm_ir = dev->priv;
 	struct pwm_device *pwm = pwm_ir->pwm;
-	int i, duty, period;
+	struct pwm_state state;
+	int i;
 	ktime_t edge;
 	long delta;
 
-	period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, pwm_ir->carrier);
-	duty = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * period, 100);
+	pwm_init_state(pwm, &state);
 
-	pwm_config(pwm, duty, period);
+	state.period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, pwm_ir->carrier);
+	state.duty_cycle = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * state.period, 100);
 
 	edge = ktime_get();
 
 	for (i = 0; i < count; i++) {
-		if (i % 2) // space
-			pwm_disable(pwm);
-		else
-			pwm_enable(pwm);
+		state.enabled = !(i % 2);
+		pwm_apply_state(pwm, &state);
 
 		edge = ktime_add_us(edge, txbuf[i]);
 		delta = ktime_us_delta(edge, ktime_get());
@@ -76,7 +75,8 @@ static int pwm_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
 			usleep_range(delta, delta + 10);
 	}
 
-	pwm_disable(pwm);
+	state.enabled = false;
+	pwm_apply_state(pwm, &state);
 
 	return count;
 }
-- 
2.31.1


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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
  2021-10-24 10:33 [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API Maíra Canal
@ 2021-10-25  6:08 ` Uwe Kleine-König
  2021-10-27  6:07   ` kernel test robot
  1 sibling, 0 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2021-10-25  6:08 UTC (permalink / raw)
  To: Maíra Canal
  Cc: sean, mchehab, thierry.reding, lee.jones, linux-media,
	linux-kernel, linux-pwm

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

Hello,

On Sun, Oct 24, 2021 at 07:33:47AM -0300, Maíra Canal wrote:
> Remove legacy PWM interface (pwm_config, pwm_enable, pwm_disable) and
> replace it for the atomic PWM API.
> 
> Signed-off-by: Maíra Canal <maira.canal@usp.br>
> ---
> V1 -> V2: Assign variables directly and simplify conditional statement
> V2 -> V3: Fix declaration of undeclared variable
> ---
>  drivers/media/rc/pwm-ir-tx.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/media/rc/pwm-ir-tx.c b/drivers/media/rc/pwm-ir-tx.c
> index 4bc28d2c9cc9..e1f348a962e8 100644
> --- a/drivers/media/rc/pwm-ir-tx.c
> +++ b/drivers/media/rc/pwm-ir-tx.c
> @@ -53,22 +53,21 @@ static int pwm_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
>  {
>  	struct pwm_ir *pwm_ir = dev->priv;
>  	struct pwm_device *pwm = pwm_ir->pwm;
> -	int i, duty, period;
> +	struct pwm_state state;
> +	int i;
>  	ktime_t edge;
>  	long delta;
>  
> -	period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, pwm_ir->carrier);
> -	duty = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * period, 100);
> +	pwm_init_state(pwm, &state);
>  
> -	pwm_config(pwm, duty, period);
> +	state.period = DIV_ROUND_CLOSEST(NSEC_PER_SEC, pwm_ir->carrier);
> +	state.duty_cycle = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * state.period, 100);
>  
>  	edge = ktime_get();
>  
>  	for (i = 0; i < count; i++) {
> -		if (i % 2) // space
> -			pwm_disable(pwm);
> -		else
> -			pwm_enable(pwm);
> +		state.enabled = !(i % 2);
> +		pwm_apply_state(pwm, &state);
>  
>  		edge = ktime_add_us(edge, txbuf[i]);
>  		delta = ktime_us_delta(edge, ktime_get());
> @@ -76,7 +75,8 @@ static int pwm_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
>  			usleep_range(delta, delta + 10);
>  	}
>  
> -	pwm_disable(pwm);
> +	state.enabled = false;
> +	pwm_apply_state(pwm, &state);

I would have added a struct pwm_state to struct pwm_ir and then would
call pwm_init_state() only once in .probe(). But that's subjective if
you like it better or not, so do what you prefer.

The other changes look fine, so:

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
 
Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

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

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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
  2021-10-24 10:33 [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API Maíra Canal
@ 2021-10-27  6:07   ` kernel test robot
  2021-10-27  6:07   ` kernel test robot
  1 sibling, 0 replies; 13+ messages in thread
From: kernel test robot @ 2021-10-27  6:07 UTC (permalink / raw)
  To: Maíra Canal, sean, mchehab, thierry.reding, u.kleine-koenig,
	lee.jones
  Cc: llvm, kbuild-all, linux-media, linux-kernel, linux-pwm

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

Hi "Maíra,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on media-tree/master]
[also build test ERROR on v5.15-rc7 next-20211026]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ma-ra-Canal/media-rc-pwm-ir-tx-Switch-to-atomic-PWM-API/20211024-183502
base:   git://linuxtv.org/media_tree.git master
config: riscv-randconfig-r004-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/abea850df0b6436083fcaa097ad3029a27aa62bb
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Ma-ra-Canal/media-rc-pwm-ir-tx-Switch-to-atomic-PWM-API/20211024-183502
        git checkout abea850df0b6436083fcaa097ad3029a27aa62bb
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "__udivdi3" [drivers/media/rc/pwm-ir-tx.ko] undefined!

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32140 bytes --]

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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
@ 2021-10-27  6:07   ` kernel test robot
  0 siblings, 0 replies; 13+ messages in thread
From: kernel test robot @ 2021-10-27  6:07 UTC (permalink / raw)
  To: kbuild-all

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

Hi "Maíra,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on media-tree/master]
[also build test ERROR on v5.15-rc7 next-20211026]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Ma-ra-Canal/media-rc-pwm-ir-tx-Switch-to-atomic-PWM-API/20211024-183502
base:   git://linuxtv.org/media_tree.git master
config: riscv-randconfig-r004-20211027 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/abea850df0b6436083fcaa097ad3029a27aa62bb
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Ma-ra-Canal/media-rc-pwm-ir-tx-Switch-to-atomic-PWM-API/20211024-183502
        git checkout abea850df0b6436083fcaa097ad3029a27aa62bb
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "__udivdi3" [drivers/media/rc/pwm-ir-tx.ko] undefined!

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32140 bytes --]

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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
  2021-10-27  6:07   ` kernel test robot
@ 2021-10-27  6:15     ` Uwe Kleine-König
  -1 siblings, 0 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2021-10-27  6:15 UTC (permalink / raw)
  To: kernel test robot
  Cc: Maíra Canal, sean, mchehab, thierry.reding, lee.jones, llvm,
	kbuild-all, linux-media, linux-kernel, linux-pwm

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

On Wed, Oct 27, 2021 at 02:07:19PM +0800, kernel test robot wrote:
> Hi "Maíra,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on media-tree/master]
> [also build test ERROR on v5.15-rc7 next-20211026]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Ma-ra-Canal/media-rc-pwm-ir-tx-Switch-to-atomic-PWM-API/20211024-183502
> base:   git://linuxtv.org/media_tree.git master
> config: riscv-randconfig-r004-20211027 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install riscv cross compiling tool for clang build
>         # apt-get install binutils-riscv64-linux-gnu
>         # https://github.com/0day-ci/linux/commit/abea850df0b6436083fcaa097ad3029a27aa62bb
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Ma-ra-Canal/media-rc-pwm-ir-tx-Switch-to-atomic-PWM-API/20211024-183502
>         git checkout abea850df0b6436083fcaa097ad3029a27aa62bb
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>, old ones prefixed by <<):
> 
> >> ERROR: modpost: "__udivdi3" [drivers/media/rc/pwm-ir-tx.ko] undefined!

This comes from the line:

	state.duty_cycle = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * state.period, 100);

where DIV_ROUND_CLOSEST expands to a normal division but state.period is
a u64. So this should use DIV64_U64_ROUND_CLOSEST I guess.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

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

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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
@ 2021-10-27  6:15     ` Uwe Kleine-König
  0 siblings, 0 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2021-10-27  6:15 UTC (permalink / raw)
  To: kbuild-all

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

On Wed, Oct 27, 2021 at 02:07:19PM +0800, kernel test robot wrote:
> Hi "Maíra,
> 
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on media-tree/master]
> [also build test ERROR on v5.15-rc7 next-20211026]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]
> 
> url:    https://github.com/0day-ci/linux/commits/Ma-ra-Canal/media-rc-pwm-ir-tx-Switch-to-atomic-PWM-API/20211024-183502
> base:   git://linuxtv.org/media_tree.git master
> config: riscv-randconfig-r004-20211027 (attached as .config)
> compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 5db7568a6a1fcb408eb8988abdaff2a225a8eb72)
> reproduce (this is a W=1 build):
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # install riscv cross compiling tool for clang build
>         # apt-get install binutils-riscv64-linux-gnu
>         # https://github.com/0day-ci/linux/commit/abea850df0b6436083fcaa097ad3029a27aa62bb
>         git remote add linux-review https://github.com/0day-ci/linux
>         git fetch --no-tags linux-review Ma-ra-Canal/media-rc-pwm-ir-tx-Switch-to-atomic-PWM-API/20211024-183502
>         git checkout abea850df0b6436083fcaa097ad3029a27aa62bb
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All errors (new ones prefixed by >>, old ones prefixed by <<):
> 
> >> ERROR: modpost: "__udivdi3" [drivers/media/rc/pwm-ir-tx.ko] undefined!

This comes from the line:

	state.duty_cycle = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * state.period, 100);

where DIV_ROUND_CLOSEST expands to a normal division but state.period is
a u64. So this should use DIV64_U64_ROUND_CLOSEST I guess.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

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

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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
  2021-10-27  6:15     ` Uwe Kleine-König
@ 2021-10-27  7:32       ` Sean Young
  -1 siblings, 0 replies; 13+ messages in thread
From: Sean Young @ 2021-10-27  7:32 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: kernel test robot, Maíra Canal, mchehab, thierry.reding,
	lee.jones, llvm, kbuild-all, linux-media, linux-kernel,
	linux-pwm

On Wed, Oct 27, 2021 at 08:15:52AM +0200, Uwe Kleine-König wrote:
> On Wed, Oct 27, 2021 at 02:07:19PM +0800, kernel test robot wrote:
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All errors (new ones prefixed by >>, old ones prefixed by <<):
> > 
> > >> ERROR: modpost: "__udivdi3" [drivers/media/rc/pwm-ir-tx.ko] undefined!
> 
> This comes from the line:
> 
> 	state.duty_cycle = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * state.period, 100);
> 
> where DIV_ROUND_CLOSEST expands to a normal division but state.period is
> a u64. So this should use DIV64_U64_ROUND_CLOSEST I guess.

DIV64_U64_ROUND_CLOSEST is for dividing a u64 with a u64. We're dividing
by 100 here so this is not necessary.

It should use DIV_ROUND_CLOSEST_ULL, however it might be nicer to use:

	pwm_set_relative_duty_cycle(&state, pwm_ir->duty_cycle, 100);

Thanks

Sean

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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
@ 2021-10-27  7:32       ` Sean Young
  0 siblings, 0 replies; 13+ messages in thread
From: Sean Young @ 2021-10-27  7:32 UTC (permalink / raw)
  To: kbuild-all

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

On Wed, Oct 27, 2021 at 08:15:52AM +0200, Uwe Kleine-König wrote:
> On Wed, Oct 27, 2021 at 02:07:19PM +0800, kernel test robot wrote:
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > 
> > All errors (new ones prefixed by >>, old ones prefixed by <<):
> > 
> > >> ERROR: modpost: "__udivdi3" [drivers/media/rc/pwm-ir-tx.ko] undefined!
> 
> This comes from the line:
> 
> 	state.duty_cycle = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * state.period, 100);
> 
> where DIV_ROUND_CLOSEST expands to a normal division but state.period is
> a u64. So this should use DIV64_U64_ROUND_CLOSEST I guess.

DIV64_U64_ROUND_CLOSEST is for dividing a u64 with a u64. We're dividing
by 100 here so this is not necessary.

It should use DIV_ROUND_CLOSEST_ULL, however it might be nicer to use:

	pwm_set_relative_duty_cycle(&state, pwm_ir->duty_cycle, 100);

Thanks

Sean

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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
  2021-10-27  7:32       ` Sean Young
  (?)
@ 2021-10-27 12:38       ` Maíra Canal
  2021-10-27 12:43           ` Maíra Canal
  -1 siblings, 1 reply; 13+ messages in thread
From: Maíra Canal @ 2021-10-27 12:38 UTC (permalink / raw)
  To: kbuild-all

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

Thank you for the feedback! I appreciate that! I'm new at the kernel and I
got a little confused about how to send the new patch. Should I send a v4
of this patch or just send a new patch fixing this issue? I'm sorry about
the question and thank you for your attention.

Em qua., 27 de out. de 2021 às 04:32, Sean Young <sean@mess.org> escreveu:

> On Wed, Oct 27, 2021 at 08:15:52AM +0200, Uwe Kleine-König wrote:
> > On Wed, Oct 27, 2021 at 02:07:19PM +0800, kernel test robot wrote:
> > > If you fix the issue, kindly add following tag as appropriate
> > > Reported-by: kernel test robot <lkp@intel.com>
> > >
> > > All errors (new ones prefixed by >>, old ones prefixed by <<):
> > >
> > > >> ERROR: modpost: "__udivdi3" [drivers/media/rc/pwm-ir-tx.ko]
> undefined!
> >
> > This comes from the line:
> >
> >       state.duty_cycle = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle *
> state.period, 100);
> >
> > where DIV_ROUND_CLOSEST expands to a normal division but state.period is
> > a u64. So this should use DIV64_U64_ROUND_CLOSEST I guess.
>
> DIV64_U64_ROUND_CLOSEST is for dividing a u64 with a u64. We're dividing
> by 100 here so this is not necessary.
>
> It should use DIV_ROUND_CLOSEST_ULL, however it might be nicer to use:
>
>         pwm_set_relative_duty_cycle(&state, pwm_ir->duty_cycle, 100);
>
> Thanks
>
> Sean
>

[-- Attachment #2: attachment.htm --]
[-- Type: text/html, Size: 1836 bytes --]

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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
  2021-10-27 12:38       ` Maíra Canal
@ 2021-10-27 12:43           ` Maíra Canal
  0 siblings, 0 replies; 13+ messages in thread
From: Maíra Canal @ 2021-10-27 12:43 UTC (permalink / raw)
  To: Sean Young
  Cc: Uwe Kleine-König, kernel test robot, mchehab,
	thierry.reding, Lee Jones, llvm, kbuild-all, linux-media,
	linux-kernel, linux-pwm

[resend it in Plain Text]
Thank you for the feedback! I appreciate that! I'm new at the kernel
and I got a little confused about how to send the new patch. Should I
send a v4 of this patch or just send a new patch fixing this issue?
I'm sorry about the question and thank you for your attention.

> Em qua., 27 de out. de 2021 às 04:32, Sean Young <sean@mess.org> escreveu:
>>
>> On Wed, Oct 27, 2021 at 08:15:52AM +0200, Uwe Kleine-König wrote:
>> > On Wed, Oct 27, 2021 at 02:07:19PM +0800, kernel test robot wrote:
>> > > If you fix the issue, kindly add following tag as appropriate
>> > > Reported-by: kernel test robot <lkp@intel.com>
>> > >
>> > > All errors (new ones prefixed by >>, old ones prefixed by <<):
>> > >
>> > > >> ERROR: modpost: "__udivdi3" [drivers/media/rc/pwm-ir-tx.ko] undefined!
>> >
>> > This comes from the line:
>> >
>> >       state.duty_cycle = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * state.period, 100);
>> >
>> > where DIV_ROUND_CLOSEST expands to a normal division but state.period is
>> > a u64. So this should use DIV64_U64_ROUND_CLOSEST I guess.
>>
>> DIV64_U64_ROUND_CLOSEST is for dividing a u64 with a u64. We're dividing
>> by 100 here so this is not necessary.
>>
>> It should use DIV_ROUND_CLOSEST_ULL, however it might be nicer to use:
>>
>>         pwm_set_relative_duty_cycle(&state, pwm_ir->duty_cycle, 100);
>>
>> Thanks
>>
>> Sean

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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
@ 2021-10-27 12:43           ` Maíra Canal
  0 siblings, 0 replies; 13+ messages in thread
From: Maíra Canal @ 2021-10-27 12:43 UTC (permalink / raw)
  To: kbuild-all

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

[resend it in Plain Text]
Thank you for the feedback! I appreciate that! I'm new at the kernel
and I got a little confused about how to send the new patch. Should I
send a v4 of this patch or just send a new patch fixing this issue?
I'm sorry about the question and thank you for your attention.

> Em qua., 27 de out. de 2021 às 04:32, Sean Young <sean@mess.org> escreveu:
>>
>> On Wed, Oct 27, 2021 at 08:15:52AM +0200, Uwe Kleine-König wrote:
>> > On Wed, Oct 27, 2021 at 02:07:19PM +0800, kernel test robot wrote:
>> > > If you fix the issue, kindly add following tag as appropriate
>> > > Reported-by: kernel test robot <lkp@intel.com>
>> > >
>> > > All errors (new ones prefixed by >>, old ones prefixed by <<):
>> > >
>> > > >> ERROR: modpost: "__udivdi3" [drivers/media/rc/pwm-ir-tx.ko] undefined!
>> >
>> > This comes from the line:
>> >
>> >       state.duty_cycle = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * state.period, 100);
>> >
>> > where DIV_ROUND_CLOSEST expands to a normal division but state.period is
>> > a u64. So this should use DIV64_U64_ROUND_CLOSEST I guess.
>>
>> DIV64_U64_ROUND_CLOSEST is for dividing a u64 with a u64. We're dividing
>> by 100 here so this is not necessary.
>>
>> It should use DIV_ROUND_CLOSEST_ULL, however it might be nicer to use:
>>
>>         pwm_set_relative_duty_cycle(&state, pwm_ir->duty_cycle, 100);
>>
>> Thanks
>>
>> Sean

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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
  2021-10-27 12:43           ` Maíra Canal
@ 2021-10-27 12:48             ` Sean Young
  -1 siblings, 0 replies; 13+ messages in thread
From: Sean Young @ 2021-10-27 12:48 UTC (permalink / raw)
  To: Maíra Canal
  Cc: Uwe Kleine-König, kernel test robot, mchehab,
	thierry.reding, Lee Jones, llvm, kbuild-all, linux-media,
	linux-kernel, linux-pwm

Hi Maíra,

On Wed, Oct 27, 2021 at 09:43:47AM -0300, Maíra Canal wrote:
> [resend it in Plain Text]
> Thank you for the feedback! I appreciate that! I'm new at the kernel
> and I got a little confused about how to send the new patch. Should I
> send a v4 of this patch or just send a new patch fixing this issue?
> I'm sorry about the question and thank you for your attention.

Please send out a v4 with the problem fixed.

Also top-posting is deprecated on linux mailing lists.

Thanks,

Sean

> > Em qua., 27 de out. de 2021 às 04:32, Sean Young <sean@mess.org> escreveu:
> >>
> >> On Wed, Oct 27, 2021 at 08:15:52AM +0200, Uwe Kleine-König wrote:
> >> > On Wed, Oct 27, 2021 at 02:07:19PM +0800, kernel test robot wrote:
> >> > > If you fix the issue, kindly add following tag as appropriate
> >> > > Reported-by: kernel test robot <lkp@intel.com>
> >> > >
> >> > > All errors (new ones prefixed by >>, old ones prefixed by <<):
> >> > >
> >> > > >> ERROR: modpost: "__udivdi3" [drivers/media/rc/pwm-ir-tx.ko] undefined!
> >> >
> >> > This comes from the line:
> >> >
> >> >       state.duty_cycle = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * state.period, 100);
> >> >
> >> > where DIV_ROUND_CLOSEST expands to a normal division but state.period is
> >> > a u64. So this should use DIV64_U64_ROUND_CLOSEST I guess.
> >>
> >> DIV64_U64_ROUND_CLOSEST is for dividing a u64 with a u64. We're dividing
> >> by 100 here so this is not necessary.
> >>
> >> It should use DIV_ROUND_CLOSEST_ULL, however it might be nicer to use:
> >>
> >>         pwm_set_relative_duty_cycle(&state, pwm_ir->duty_cycle, 100);
> >>
> >> Thanks
> >>
> >> Sean

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

* Re: [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API
@ 2021-10-27 12:48             ` Sean Young
  0 siblings, 0 replies; 13+ messages in thread
From: Sean Young @ 2021-10-27 12:48 UTC (permalink / raw)
  To: kbuild-all

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

Hi Maíra,

On Wed, Oct 27, 2021 at 09:43:47AM -0300, Maíra Canal wrote:
> [resend it in Plain Text]
> Thank you for the feedback! I appreciate that! I'm new at the kernel
> and I got a little confused about how to send the new patch. Should I
> send a v4 of this patch or just send a new patch fixing this issue?
> I'm sorry about the question and thank you for your attention.

Please send out a v4 with the problem fixed.

Also top-posting is deprecated on linux mailing lists.

Thanks,

Sean

> > Em qua., 27 de out. de 2021 às 04:32, Sean Young <sean@mess.org> escreveu:
> >>
> >> On Wed, Oct 27, 2021 at 08:15:52AM +0200, Uwe Kleine-König wrote:
> >> > On Wed, Oct 27, 2021 at 02:07:19PM +0800, kernel test robot wrote:
> >> > > If you fix the issue, kindly add following tag as appropriate
> >> > > Reported-by: kernel test robot <lkp@intel.com>
> >> > >
> >> > > All errors (new ones prefixed by >>, old ones prefixed by <<):
> >> > >
> >> > > >> ERROR: modpost: "__udivdi3" [drivers/media/rc/pwm-ir-tx.ko] undefined!
> >> >
> >> > This comes from the line:
> >> >
> >> >       state.duty_cycle = DIV_ROUND_CLOSEST(pwm_ir->duty_cycle * state.period, 100);
> >> >
> >> > where DIV_ROUND_CLOSEST expands to a normal division but state.period is
> >> > a u64. So this should use DIV64_U64_ROUND_CLOSEST I guess.
> >>
> >> DIV64_U64_ROUND_CLOSEST is for dividing a u64 with a u64. We're dividing
> >> by 100 here so this is not necessary.
> >>
> >> It should use DIV_ROUND_CLOSEST_ULL, however it might be nicer to use:
> >>
> >>         pwm_set_relative_duty_cycle(&state, pwm_ir->duty_cycle, 100);
> >>
> >> Thanks
> >>
> >> Sean

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

end of thread, other threads:[~2021-10-27 12:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-24 10:33 [PATCH v3] media: rc: pwm-ir-tx: Switch to atomic PWM API Maíra Canal
2021-10-25  6:08 ` Uwe Kleine-König
2021-10-27  6:07 ` kernel test robot
2021-10-27  6:07   ` kernel test robot
2021-10-27  6:15   ` Uwe Kleine-König
2021-10-27  6:15     ` Uwe Kleine-König
2021-10-27  7:32     ` Sean Young
2021-10-27  7:32       ` Sean Young
2021-10-27 12:38       ` Maíra Canal
2021-10-27 12:43         ` Maíra Canal
2021-10-27 12:43           ` Maíra Canal
2021-10-27 12:48           ` Sean Young
2021-10-27 12:48             ` Sean Young

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.