From: Roy Im <roy.im.opensource@diasemi.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Roy Im" <roy.im.opensource@diasemi.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Brian Masney <masneyb@onstation.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Greg KH <gregkh@linuxfoundation.org>,
Lee Jones <lee.jones@linaro.org>, Luca Weiss <luca@z3ntu.xyz>,
Maximilian Luz <luzmaximilian@gmail.com>,
Pascal PAILLET-LME <p.paillet@st.com>,
Rob Herring <robh@kernel.org>,
Samuel Ortiz <sameo@linux.intel.com>,
Thierry Reding <thierry.reding@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Support Opensource <Support.Opensource@diasemi.com>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>
Subject: RE: [RESEND PATCH V13 3/3] Input: new da7280 haptic driver
Date: Wed, 24 Jun 2020 15:39:52 +0000 [thread overview]
Message-ID: <DB8PR10MB3356AFC38358881B471E76A285950@DB8PR10MB3356.EURPRD10.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <20200624133726.en7q52rpdtzvhajz@taurus.defre.kleine-koenig.org>
On Wed, Jun 24, 2020 at 10:37 PM, Uwe Kleine-König wrote:
> On Wed, Jun 24, 2020 at 12:04:24PM +0900, Roy Im wrote:
> > Hello Uwe,
> >
> > On Tue, June 23, 2020 11:41 PM, Uwe Kleine-König wrote:
> > >
> > > Hello,
> > >
> > > On Mon, Jun 15, 2020 at 08:40:23PM +0900, Roy Im wrote:
> > > > Adds support for the Dialog DA7280 LRA/ERM Haptic Driver with
> > > > multiple mode and integrated waveform memory and wideband support.
> > > > It communicates via an I2C bus to the device.
> > > >
> > > > Signed-off-by: Roy Im <roy.im.opensource@diasemi.com>
> > > >
> > > > + period2freq = 1000000 / state.period;
> > > > + if (period2freq < DA7280_MIN_PWM_FREQ_KHZ ||
> > > > + period2freq > DA7280_MAX_PWM_FREQ_KHZ) {
> > > > + dev_err(dev, "Not supported PWM frequency(%d)\n",
> > > > + period2freq);
> > >
> > > Doesn't the compiler warn here about period2freq being unsigned and %d being for signed int values?
> > >
> > > For my (non-native) English ear s/Not supported/Unsupported/ sounds
> > > better. Also my eyes would be pleases by a space before the opening brace.
> >
> > I didn't see any warning message, but I will change/improve them to proper one and the log as below.
> >
> > period2freq = 1000000 / state.period;
> > if (period2freq < DA7280_MIN_PWM_FREQ_KHZ ||
> > period2freq > DA7280_MAX_PWM_FREQ_KHZ) {
> > dev_err(dev, "Unsupported PWM frequency (%u)\n",
> > period2freq);
> > return -EINVAL;
> > }
> > If you look ok, let me update this so.
>
> looks fine.
>
> Note that you don't need the division if you check for:
>
> if (state.period > 100000 || state.period < 4000) {
> ...
>
> (maybe the compiler is already clever enough to get rid of the division for you, but then the check is:
>
> if (state.period > 100000 || state.period < 3985) {
>
> because of rounding errors.)
OK, you are right, that will be better. So let me change that as below if you look fine.
/* Check PWM period, PWM freq = 1000000 / state.period.
* The valid PWM freq range: 10k ~ 250kHz.
*/
if (state.period > 100000 || state.period < 3985) {
dev_err(dev, "Unsupported PWM period (%u)\n",
state.period);
return -EINVAL;
}
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K. | Uwe Kleine-König |
> Industrial Linux Solutions | https://www.pengutronix.de/ |
next prev parent reply other threads:[~2020-06-24 15:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-15 11:40 [RESEND PATCH V13 0/3] da7280: haptic driver submission Roy Im
2020-06-15 11:40 ` [RESEND PATCH V13 2/3] dt-bindings: input: Add document bindings for DA7280 Roy Im
2020-06-15 11:40 ` [RESEND PATCH V13 1/3] MAINTAINERS: da7280 updates to the Dialog Semiconductor search terms Roy Im
2020-06-15 11:40 ` [RESEND PATCH V13 3/3] Input: new da7280 haptic driver Roy Im
2020-06-23 14:41 ` Uwe Kleine-König
2020-06-24 12:04 ` Roy Im
2020-06-24 13:37 ` Uwe Kleine-König
2020-06-24 15:39 ` Roy Im [this message]
2020-06-24 16:28 ` Uwe Kleine-König
2020-06-24 16:56 ` Roy Im
-- strict thread matches above, loose matches on Subject: below --
2020-05-21 9:24 [RESEND PATCH V13 0/3] da7280: haptic driver submission Roy Im
2020-05-21 9:24 ` [RESEND PATCH V13 3/3] Input: new da7280 haptic driver Roy Im
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=DB8PR10MB3356AFC38358881B471E76A285950@DB8PR10MB3356.EURPRD10.PROD.OUTLOOK.COM \
--to=roy.im.opensource@diasemi.com \
--cc=Support.Opensource@diasemi.com \
--cc=bgolaszewski@baylibre.com \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=lee.jones@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=luca@z3ntu.xyz \
--cc=luzmaximilian@gmail.com \
--cc=masneyb@onstation.org \
--cc=p.paillet@st.com \
--cc=robh@kernel.org \
--cc=sameo@linux.intel.com \
--cc=tglx@linutronix.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).