From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: Manuel Traut <manuel.traut@mt.com>, linux-kernel@vger.kernel.org
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Frieder Schrempf <frieder.schrempf@kontron.de>,
linux-input@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 5/5 v7] input: pwm-beeper: handle module unloading properly
Date: Tue, 24 Jan 2023 18:00:52 +0100 [thread overview]
Message-ID: <fd8d6f46-9d4a-c74d-6af4-0abbc0c54526@linaro.org> (raw)
In-Reply-To: <Y9AK71Q7X4d+1E4f@mt.com>
On 24/01/2023 17:44, Manuel Traut wrote:
> 'input: pwm-beeper: add feature to set volume via sysfs' adds device
> attributes without removing them on error or if the module is unloaded.
>
> This change removes the device attributes on module unloading or if
Do not use "This commit/patch".
https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95
> registering on the input subsystem fails.
>
> If the module will be unloaded and loaded again it fails:
> [ 1007.918180] sysfs: cannot create duplicate filename '/devices/platform/buzzer/volume'
>
> Signed-off-by: Manuel Traut <manuel.traut@mt.com>
> ---
> drivers/input/misc/pwm-beeper.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
> index fe543c4151d6..8ef2937e8f21 100644
> --- a/drivers/input/misc/pwm-beeper.c
> +++ b/drivers/input/misc/pwm-beeper.c
> @@ -300,6 +300,7 @@ static int pwm_beeper_probe(struct platform_device *pdev)
>
> error = input_register_device(beeper->input);
> if (error) {
> + sysfs_remove_group(&pdev->dev.kobj, &pwm_beeper_attribute_group);
> dev_err(dev, "Failed to register input device: %d\n", error);
> return error;
> }
> @@ -309,6 +310,17 @@ static int pwm_beeper_probe(struct platform_device *pdev)
> return 0;
> }
>
> +static int pwm_beeper_remove(struct platform_device *pdev)
> +{
> + struct pwm_beeper *beeper;
> +
> + beeper = platform_get_drvdata(pdev);
Wrong indentation.
Please run scripts/checkpatch.pl and fix reported warnings.
> + input_unregister_device(beeper->input);
Best regards,
Krzysztof
prev parent reply other threads:[~2023-01-24 17:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-24 16:44 [PATCH 5/5 v7] input: pwm-beeper: handle module unloading properly Manuel Traut
2023-01-24 17:00 ` Krzysztof Kozlowski [this message]
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=fd8d6f46-9d4a-c74d-6af4-0abbc0c54526@linaro.org \
--to=krzysztof.kozlowski@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=frieder.schrempf@kontron.de \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manuel.traut@mt.com \
--cc=robh+dt@kernel.org \
/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).