From: "Thomas Weißschuh" <thomas@t-8ch.de>
To: Charles Mirabile <cmirabil@redhat.com>
Cc: linux-kernel@vger.kernel.org, Lee Jones <lee.jones@linaro.org>,
Serge Schneider <serge@raspberrypi.org>,
Stefan Wahren <stefan.wahren@i2se.com>,
Nicolas Saenz Julienne <nsaenzju@redhat.com>,
linux-rpi-kernel@lists.infradead.org,
fedora-rpi@googlegroups.com, Mwesigwa Guma <mguma@redhat.com>,
Joel Savitz <jsavitz@redhat.com>
Subject: Re: [PATCH 1/5] drivers/mfd: sensehat: Raspberry Pi Sense HAT core driver
Date: Sat, 30 Oct 2021 19:20:16 +0200 [thread overview]
Message-ID: <12caa13c-7399-49c9-9a2d-689a646891d0@t-8ch.de> (raw)
In-Reply-To: <20211029215516.801593-2-cmirabil@redhat.com>
On 2021-10-29 17:55-0400, Charles Mirabile wrote:
> +static int sensehat_probe(struct i2c_client *i2c,
> + const struct i2c_device_id *id)
> +{
> ...
> +
> + sensehat->joystick.pdev = sensehat_client_dev_register(sensehat,
> + "sensehat-joystick");
Will this not fail the complete driver load if the driver for this single
subdevice is not available?
For example if the Kconfig option has not been selected, the patch for the
driver is not applied or the user has blacklisted the respective module in
their system.
> + if (IS_ERR(sensehat->joystick.pdev)) {
> + dev_err(sensehat->dev, "failed to register sensehat-joystick");
> + return PTR_ERR(sensehat->joystick.pdev);
> + }
> +
> + sensehat->display.pdev = sensehat_client_dev_register(sensehat,
> + "sensehat-display");
Same as above.
> +
> + if (IS_ERR(sensehat->display.pdev)) {
> + dev_err(sensehat->dev, "failed to register sensehat-display");
> + return PTR_ERR(sensehat->display.pdev);
> + }
> +
> + return 0;
> +}
> +
> +static struct platform_device *
> +sensehat_client_dev_register(struct sensehat *sensehat, const char *name)
> +{
> + long ret = -ENOMEM;
> + struct platform_device *pdev = platform_device_alloc(name, -1);
> +
> + if (!pdev)
> + goto alloc_fail;
> +
> + pdev->dev.parent = sensehat->dev;
> + platform_set_drvdata(pdev, sensehat);
> +
> + ret = platform_device_add(pdev);
> + if (ret)
> + goto add_fail;
> +
> + ret = devm_add_action_or_reset(sensehat->dev,
> + (void *)platform_device_unregister, pdev);
> + if (ret)
> + goto alloc_fail;
> +
> + return pdev;
> +
> +add_fail:
> + platform_device_put(pdev);
> +alloc_fail:
> + return ERR_PTR(ret);
> +}
Thomas
next prev parent reply other threads:[~2021-10-30 17:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-29 21:55 [PATCH 0/5] Raspberry Pi Sense HAT driver Charles Mirabile
2021-10-29 21:55 ` [PATCH 1/5] drivers/mfd: sensehat: Raspberry Pi Sense HAT core driver Charles Mirabile
2021-10-30 8:02 ` kernel test robot
2021-10-30 17:20 ` Thomas Weißschuh [this message]
2021-11-03 16:33 ` Matthias Brugger
2021-11-03 16:53 ` nsaenzju
2021-10-29 21:55 ` [PATCH 2/5] drivers/input/joystick: sensehat: Raspberry Pi Sense HAT joystick driver Charles Mirabile
2021-10-29 22:03 ` Randy Dunlap
2021-10-30 14:02 ` kernel test robot
2021-10-29 21:55 ` [PATCH 3/5] drivers/auxdisplay: senshat: Raspberry Pi Sense HAT display driver Charles Mirabile
2021-10-30 22:12 ` kernel test robot
2021-11-03 16:47 ` Matthias Brugger
2021-10-29 21:55 ` [PATCH 4/5] Documentation: bindings/mfd: sensehat: Raspberry Pi Sense HAT device tree binding Charles Mirabile
2021-11-02 12:51 ` Rob Herring
2021-10-29 21:55 ` [PATCH 5/5] MAINTAINERS: Add sensehat driver authors to MAINTAINERS Charles Mirabile
2021-10-31 16:38 ` [PATCH 0/5] Raspberry Pi Sense HAT driver Miguel Ojeda
2021-11-01 14:18 ` Joel Savitz
2021-11-20 10:55 ` Stefan Wahren
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=12caa13c-7399-49c9-9a2d-689a646891d0@t-8ch.de \
--to=thomas@t-8ch.de \
--cc=cmirabil@redhat.com \
--cc=fedora-rpi@googlegroups.com \
--cc=jsavitz@redhat.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=mguma@redhat.com \
--cc=nsaenzju@redhat.com \
--cc=serge@raspberrypi.org \
--cc=stefan.wahren@i2se.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
all inboxes | Powered by JetHome®