All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Markus Pargmann <mpa@pengutronix.de>
Cc: Wim Van Sebroeck <wim@iguana.be>,
	Support Opensource <support.opensource@diasemi.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	linux-watchdog@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de
Subject: Re: [PATCH v6] watchdog: Add DA9063 PMIC watchdog driver.
Date: Wed, 24 Sep 2014 06:30:55 -0700	[thread overview]
Message-ID: <5422C78F.4020507@roeck-us.net> (raw)
In-Reply-To: <20140924091055.GB25366@pengutronix.de>

On 09/24/2014 02:10 AM, Markus Pargmann wrote:
> Hi,
>
> sorry for the late reply, I was on vacation.
>

No problem. Hope you had fun :-)

>>> +
>>> +static int da9063_wdt_probe(struct platform_device *pdev)
>>> +{
>>> +	int ret;
>>> +	struct da9063 *da9063;
>>> +	struct da9063_watchdog *wdt;
>>> +
>>> +	if (!pdev->dev.parent)
>>> +		return -EINVAL;
>>> +
>>> +	da9063 = dev_get_drvdata(pdev->dev.parent);
>>> +	if (!da9063)
>>> +		return -EINVAL;
>>> +
>>
>> This is not really an invalid argument. -ENODEV seems to be more appropriate,
>> given the context (presumably it means that there is no parent mfd device).
>
> Yes, but ENODEV will not result in a probe error message because the
> driver core assumes that the driver is not for this device. I would like
> to have a probe error message so that developers immediately see that
> something went wrong. This driver without a parent is a invalid setup,
> so I chose EINVAL.
> I prefer returning -EINVAL but as an alternative I could add an error
> message here and return ENODEV.
>

Good point. Given the context, one can argue that having no driver data _is_
an invalid argument (to the function), so I am fine with that.

Guenter


WARNING: multiple messages have this Message-ID (diff)
From: linux@roeck-us.net (Guenter Roeck)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6] watchdog: Add DA9063 PMIC watchdog driver.
Date: Wed, 24 Sep 2014 06:30:55 -0700	[thread overview]
Message-ID: <5422C78F.4020507@roeck-us.net> (raw)
In-Reply-To: <20140924091055.GB25366@pengutronix.de>

On 09/24/2014 02:10 AM, Markus Pargmann wrote:
> Hi,
>
> sorry for the late reply, I was on vacation.
>

No problem. Hope you had fun :-)

>>> +
>>> +static int da9063_wdt_probe(struct platform_device *pdev)
>>> +{
>>> +	int ret;
>>> +	struct da9063 *da9063;
>>> +	struct da9063_watchdog *wdt;
>>> +
>>> +	if (!pdev->dev.parent)
>>> +		return -EINVAL;
>>> +
>>> +	da9063 = dev_get_drvdata(pdev->dev.parent);
>>> +	if (!da9063)
>>> +		return -EINVAL;
>>> +
>>
>> This is not really an invalid argument. -ENODEV seems to be more appropriate,
>> given the context (presumably it means that there is no parent mfd device).
>
> Yes, but ENODEV will not result in a probe error message because the
> driver core assumes that the driver is not for this device. I would like
> to have a probe error message so that developers immediately see that
> something went wrong. This driver without a parent is a invalid setup,
> so I chose EINVAL.
> I prefer returning -EINVAL but as an alternative I could add an error
> message here and return ENODEV.
>

Good point. Given the context, one can argue that having no driver data _is_
an invalid argument (to the function), so I am fine with that.

Guenter

  reply	other threads:[~2014-09-24 13:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 13:58 [PATCH v6] watchdog: Add DA9063 PMIC watchdog driver Markus Pargmann
2014-09-08 13:58 ` Markus Pargmann
2014-09-11 16:30 ` Guenter Roeck
2014-09-11 16:30   ` Guenter Roeck
2014-09-24  9:10   ` Markus Pargmann
2014-09-24  9:10     ` Markus Pargmann
2014-09-24 13:30     ` Guenter Roeck [this message]
2014-09-24 13:30       ` Guenter Roeck
2014-09-19  4:33 ` Guenter Roeck
2014-09-19  4:33   ` Guenter Roeck

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=5422C78F.4020507@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=mpa@pengutronix.de \
    --cc=p.zabel@pengutronix.de \
    --cc=support.opensource@diasemi.com \
    --cc=wim@iguana.be \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.