All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Young <sean@mess.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: "Maíra Canal" <maira.canal@usp.br>,
	lkp@intel.com, mchehab@kernel.org, thierry.reding@gmail.com,
	lee.jones@linaro.org, llvm@lists.linux.dev,
	kbuild-all@lists.01.org, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org
Subject: Re: [PATCH v4] media: rc: pwm-ir-tx: Switch to atomic PWM API
Date: Thu, 28 Oct 2021 10:14:42 +0100	[thread overview]
Message-ID: <20211028091442.GA16514@gofer.mess.org> (raw)
In-Reply-To: <20211028064513.guziv6uaivzlk6ki@pengutronix.de>

On Thu, Oct 28, 2021 at 08:45:13AM +0200, Uwe Kleine-König wrote:
> The conversion is right (I think),

We still have the problem that the pwm drivers calculate the period
incorrectly by rounding down (except pwm-bcm2835). So the period is not
as good as it could be in most cases, but this driver can't do anything
about that.

> note this could be optimized a bit
> further: state.period only depends on carrier which rarely changes, so
> the calculation could be done in pwm_ir_set_carrier(). Ditto for duty
> which only depends on state.period and pwm_ir->duty_cycle. (This is for
> a separate commit though.)

I'm not sure what caching this is much of a win. The calculation is a few
instructions, so you're not winning in the way of speed. On the flip side
you use more memory since pwm_state has to be kmalloc() rather than existing
just on the stack, and both ioctl handlers and the probe function need to
recalculate the period/duty cycle, so there is a slight increase in code size.

This change does not improve anything measurably and only increases code
complexity.

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

Thanks for your review.


Sean

WARNING: multiple messages have this Message-ID (diff)
From: Sean Young <sean@mess.org>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v4] media: rc: pwm-ir-tx: Switch to atomic PWM API
Date: Thu, 28 Oct 2021 10:14:42 +0100	[thread overview]
Message-ID: <20211028091442.GA16514@gofer.mess.org> (raw)
In-Reply-To: <20211028064513.guziv6uaivzlk6ki@pengutronix.de>

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

On Thu, Oct 28, 2021 at 08:45:13AM +0200, Uwe Kleine-König wrote:
> The conversion is right (I think),

We still have the problem that the pwm drivers calculate the period
incorrectly by rounding down (except pwm-bcm2835). So the period is not
as good as it could be in most cases, but this driver can't do anything
about that.

> note this could be optimized a bit
> further: state.period only depends on carrier which rarely changes, so
> the calculation could be done in pwm_ir_set_carrier(). Ditto for duty
> which only depends on state.period and pwm_ir->duty_cycle. (This is for
> a separate commit though.)

I'm not sure what caching this is much of a win. The calculation is a few
instructions, so you're not winning in the way of speed. On the flip side
you use more memory since pwm_state has to be kmalloc() rather than existing
just on the stack, and both ioctl handlers and the probe function need to
recalculate the period/duty cycle, so there is a slight increase in code size.

This change does not improve anything measurably and only increases code
complexity.

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

Thanks for your review.


Sean

  reply	other threads:[~2021-10-28  9:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27 15:34 [PATCH v4] media: rc: pwm-ir-tx: Switch to atomic PWM API Maíra Canal
2021-10-27 15:34 ` Maíra Canal
2021-10-28  6:45 ` Uwe Kleine-König
2021-10-28  6:45   ` Uwe Kleine-König
2021-10-28  9:14   ` Sean Young [this message]
2021-10-28  9:14     ` Sean Young
2021-10-28 11:15     ` Uwe Kleine-König
2021-10-28 11:15       ` Uwe Kleine-König
2021-10-28 12:26       ` Sean Young
2021-10-28 12:26         ` Sean Young
2021-10-28 18:05         ` Uwe Kleine-König
2021-10-28 18:05           ` Uwe Kleine-König
2021-10-29  7:16           ` Sean Young
2021-10-29  7:16             ` Sean Young
2021-10-29 11:06             ` Uwe Kleine-König
2021-10-29 11:06               ` Uwe Kleine-König
2021-10-29 11:54               ` Sean Young
2021-10-29 11:54                 ` Sean Young
2021-10-29 12:08                 ` Maíra Canal
2021-10-29 12:08                   ` Maíra Canal
2021-10-29 15:18                   ` Uwe Kleine-König
2021-10-29 15:18                     ` Uwe Kleine-König
2021-10-30  9:21                   ` Sean Young
2021-10-30  9:21                     ` Sean Young
2021-10-31 10:39       ` Sean Young
2021-10-31 17:40         ` Uwe Kleine-König

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211028091442.GA16514@gofer.mess.org \
    --to=sean@mess.org \
    --cc=kbuild-all@lists.01.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=maira.canal@usp.br \
    --cc=mchehab@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.