From: Frank Li <Frank.li@oss.nxp.com>
To: joy.zou@oss.nxp.com
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Frank Li <Frank.Li@nxp.com>, Bough Chen <haibo.chen@nxp.com>,
Peng Fan <peng.fan@nxp.com>, Jacky Bai <ping.bai@nxp.com>,
Ye Li <ye.li@nxp.com>,
imx@lists.linux.dev, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, Joy Zou <joy.zou@nxp.com>
Subject: Re: [PATCH v3 3/4] Input: snvs_pwrkey - use local device pointer to simple code
Date: Mon, 15 Jun 2026 09:43:12 -0500 [thread overview]
Message-ID: <ajAPgNELlbL-EhWE@SMW015318> (raw)
In-Reply-To: <20260615-b4-pwrkey-v3-3-9510b1173f6e@oss.nxp.com>
On Mon, Jun 15, 2026 at 03:52:16PM +0800, joy.zou@oss.nxp.com wrote:
> [You don't often get email from joy.zou@oss.nxp.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> From: Joy Zou <joy.zou@nxp.com>
>
> Use local struct device pointer to avoid reference the platform_device
> pointer every time.
>
> No functional change.
>
> Signed-off-by: Joy Zou <joy.zou@nxp.com>
> ---
> Changes for v2:
> 1. Use dev instead of &pdev->dev for devm_input_allocate_device(),
> which was missed in patch v1 per AI review comments.
> 2. Modify commit message.
> ---
> drivers/input/keyboard/snvs_pwrkey.c | 41 ++++++++++++++++++------------------
> 1 file changed, 21 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
> index a291812e6d22..4a1d04898482 100644
> --- a/drivers/input/keyboard/snvs_pwrkey.c
> +++ b/drivers/input/keyboard/snvs_pwrkey.c
> @@ -112,6 +112,7 @@ static void imx_snvs_pwrkey_act(void *pdata)
>
> static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
> {
> + struct device *dev = &pdev->dev;
> struct pwrkey_drv_data *pdata;
> struct input_dev *input;
> struct device_node *np;
> @@ -122,26 +123,26 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
> u32 vid;
>
> /* Get SNVS register Page */
> - np = pdev->dev.of_node;
> + np = dev->of_node;
> if (!np)
> - return dev_err_probe(&pdev->dev, -ENODEV, "Device tree node not found\n");
> + return dev_err_probe(dev, -ENODEV, "Device tree node not found\n");
>
> - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> + pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> if (!pdata)
> return -ENOMEM;
>
> pdata->snvs = syscon_regmap_lookup_by_phandle(np, "regmap");
> if (IS_ERR(pdata->snvs))
> - return dev_err_probe(&pdev->dev, PTR_ERR(pdata->snvs), "Can't get snvs syscon\n");
> + return dev_err_probe(dev, PTR_ERR(pdata->snvs), "Can't get snvs syscon\n");
>
> if (of_property_read_u32(np, "linux,keycode", &pdata->keycode)) {
> pdata->keycode = KEY_POWER;
> - dev_warn(&pdev->dev, "KEY_POWER without setting in dts\n");
> + dev_warn(dev, "KEY_POWER without setting in dts\n");
> }
>
> - clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
> + clk = devm_clk_get_optional_enabled(dev, NULL);
> if (IS_ERR(clk))
> - return dev_err_probe(&pdev->dev, PTR_ERR(clk),
> + return dev_err_probe(dev, PTR_ERR(clk),
> "Failed to get snvs clock (%pe)\n", clk);
>
> pdata->wakeup = of_property_read_bool(np, "wakeup-source");
> @@ -162,7 +163,7 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
> bpt = (val / 5) - 1;
> break;
> default:
> - return dev_err_probe(&pdev->dev, -EINVAL,
> + return dev_err_probe(dev, -EINVAL,
> "power-off-time-sec %d out of range\n", val);
> }
>
> @@ -180,9 +181,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
>
> timer_setup(&pdata->check_timer, imx_imx_snvs_check_for_events, 0);
>
> - input = devm_input_allocate_device(&pdev->dev);
> + input = devm_input_allocate_device(dev);
> if (!input) {
> - dev_err(&pdev->dev, "failed to allocate the input device\n");
> + dev_err(dev, "failed to allocate the input device\n");
> return -ENOMEM;
look like you missed this one changeing to dev_err_probe() at patch 1.
Frank
> }
>
> @@ -193,27 +194,27 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
> input_set_capability(input, EV_KEY, pdata->keycode);
>
> /* input customer action to cancel release timer */
> - error = devm_add_action(&pdev->dev, imx_snvs_pwrkey_act, pdata);
> + error = devm_add_action(dev, imx_snvs_pwrkey_act, pdata);
> if (error)
> - return dev_err_probe(&pdev->dev, error, "failed to register remove action\n");
> + return dev_err_probe(dev, error, "failed to register remove action\n");
>
> pdata->input = input;
> platform_set_drvdata(pdev, pdata);
>
> - error = devm_request_irq(&pdev->dev, pdata->irq,
> - imx_snvs_pwrkey_interrupt,
> - 0, pdev->name, pdev);
> + error = devm_request_irq(dev, pdata->irq,
> + imx_snvs_pwrkey_interrupt,
> + 0, pdev->name, pdev);
> if (error)
> - return dev_err_probe(&pdev->dev, error, "interrupt not available.\n");
> + return dev_err_probe(dev, error, "interrupt not available.\n");
>
> error = input_register_device(input);
> if (error < 0)
> - return dev_err_probe(&pdev->dev, error, "failed to register input device\n");
> + return dev_err_probe(dev, error, "failed to register input device\n");
>
> - device_init_wakeup(&pdev->dev, pdata->wakeup);
> - error = dev_pm_set_wake_irq(&pdev->dev, pdata->irq);
> + device_init_wakeup(dev, pdata->wakeup);
> + error = dev_pm_set_wake_irq(dev, pdata->irq);
> if (error)
> - dev_err(&pdev->dev, "irq wake enable failed.\n");
> + dev_err(dev, "irq wake enable failed.\n");
>
> return 0;
> }
>
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2026-06-15 14:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 7:52 [PATCH v3 0/4] snvs_pwrkey - code improvements and add report event joy.zou
2026-06-15 7:52 ` [PATCH v3 1/4] Input: snvs_pwrkey - make use of dev_err_probe() joy.zou
2026-06-15 7:57 ` sashiko-bot
2026-06-15 7:52 ` [PATCH v3 2/4] Input: snvs_pwrkey - replace hardcoding -EINVAL with original error code joy.zou
2026-06-15 7:58 ` sashiko-bot
2026-06-15 14:38 ` Frank Li
2026-06-15 7:52 ` [PATCH v3 3/4] Input: snvs_pwrkey - use local device pointer to simple code joy.zou
2026-06-15 7:57 ` sashiko-bot
2026-06-15 14:40 ` Frank Li
2026-06-15 14:43 ` Frank Li [this message]
2026-06-15 7:52 ` [PATCH v3 4/4] Input: snvs_pwrkey - report press event in interrupt handler joy.zou
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=ajAPgNELlbL-EhWE@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=dmitry.torokhov@gmail.com \
--cc=haibo.chen@nxp.com \
--cc=imx@lists.linux.dev \
--cc=joy.zou@nxp.com \
--cc=joy.zou@oss.nxp.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=ping.bai@nxp.com \
--cc=ye.li@nxp.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