lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87ee35rmjx.fsf@baylibre.com>
Date:   Mon, 14 Mar 2022 09:00:18 +0100
From:   Mattijs Korpershoek <mkorpershoek@...libre.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
Cc:     Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Marco Felsch <m.felsch@...gutronix.de>,
        Rob Herring <robh+dt@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Fengping Yu <fengping.yu@...iatek.com>,
        Yingjoe Chen <yingjoe.chen@...iatek.com>,
        Fabien Parent <fparent@...libre.com>,
        Kevin Hilman <khilman@...libre.com>,
        linux-input@...r.kernel.org, devicetree@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v21 2/3] Input: mt6779-keypad - Add MediaTek keypad driver

On ven., mars 04, 2022 at 14:38, Andy Shevchenko <andriy.shevchenko@...ux.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@...iatek.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ