From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Marco Felsch <m.felsch@pengutronix.de>,
Rob Herring <robh+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
Fengping Yu <fengping.yu@mediatek.com>,
Yingjoe Chen <yingjoe.chen@mediatek.com>,
Fabien Parent <fparent@baylibre.com>,
Kevin Hilman <khilman@baylibre.com>,
linux-input@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v21 2/3] Input: mt6779-keypad - Add MediaTek keypad driver
Date: Mon, 14 Mar 2022 09:00:18 +0100 [thread overview]
Message-ID: <87ee35rmjx.fsf@baylibre.com> (raw)
In-Reply-To: <YiIINpi4zbJq/AZE@smile.fi.intel.com>
On ven., mars 04, 2022 at 14:38, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Fri, Mar 04, 2022 at 11:31:38AM +0100, AngeloGioacchino Del Regno wrote:
>> Il 03/03/22 16:43, Mattijs Korpershoek ha scritto:
>> > From: "fengping.yu" <fengping.yu@mediatek.com>
>> >
>> > This patch adds matrix keypad support for Mediatek SoCs.
>
>> > +struct mt6779_keypad {
>> > + struct regmap *regmap;
>> > + struct input_dev *input_dev;
>> > + struct clk *clk;
>
>> > + void __iomem *base;
>
> Not sure why you need this here.
You are right. There is no point of keeping this __iomem region as part
of the structure, since it's only used in the probe() function to create
the regmap.
Will send an improvement part of a later series.
>
>> > + u32 n_rows;
>> > + u32 n_cols;
>> > + DECLARE_BITMAP(keymap_state, MTK_KPD_NUM_BITS);
>> > +};
>> > +
>> > +static const struct regmap_config mt6779_keypad_regmap_cfg = {
>> > + .reg_bits = 32,
>> > + .val_bits = 32,
>> > + .reg_stride = sizeof(u32),
>> > + .max_register = 36,
>>
>> Are you sure that you can't use .fast_io = true?
>>
>> Another version for the same question:
>> Are you sure that you need to lock with a mutex here, and not with a spinlock?
>>
>> Since you're performing reads over a MMIO, I think that there's a very good
>> chance that you can use fast_io.
>>
>> > +};
>
> ...
>
>> Please use dev_err_probe() to simplify error handling in probe functions: you've
>> done a great job with adding a devm action for the error cases, avoiding gotos to
>> get out cleanly.. it would be a pity to not finish this to perfection.
>>
>> I'll give you two examples for this, so that you'll be all set.
>>
>> if (IS_ERR(keypad->regmap))
>> return dev_err_probe(&pdev->dev, PTR_ERR(keypad->regmap),
>> "regmap init failed\n");
>>
>> P.S.: No need for %pe here, as dev_err_probe prints the error number for you!
>
> Maintainer of the input subsystem is strongly against dev_err_probe() API. See
> other files there. Ditto for other cases you mentioned below.
>
> --
> With Best Regards,
> Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-03-14 8:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-03 15:42 [PATCH v21 0/3] Add matrix keypad driver support for Mediatek SoCs Mattijs Korpershoek
2022-03-03 15:43 ` [PATCH v21 1/3] dt-bindings: input: Add bindings for Mediatek matrix keypad Mattijs Korpershoek
2022-03-04 10:53 ` AngeloGioacchino Del Regno
2022-03-05 23:02 ` Dmitry Torokhov
2022-03-03 15:43 ` [PATCH v21 2/3] Input: mt6779-keypad - Add MediaTek keypad driver Mattijs Korpershoek
2022-03-04 10:31 ` AngeloGioacchino Del Regno
2022-03-04 12:38 ` Andy Shevchenko
2022-03-14 8:00 ` Mattijs Korpershoek [this message]
2022-03-05 23:04 ` Dmitry Torokhov
2022-03-14 7:57 ` Mattijs Korpershoek
2022-03-03 15:43 ` [PATCH v21 3/3] arm64: defconfig: Add CONFIG_KEYBOARD_MT6779=m Mattijs Korpershoek
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=87ee35rmjx.fsf@baylibre.com \
--to=mkorpershoek@baylibre.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=fengping.yu@mediatek.com \
--cc=fparent@baylibre.com \
--cc=khilman@baylibre.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=m.felsch@pengutronix.de \
--cc=matthias.bgg@gmail.com \
--cc=robh+dt@kernel.org \
--cc=yingjoe.chen@mediatek.com \
/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).