Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1434638

Re: [3/3] hwmon: iio_hwmon: defer probe when no channel is found

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject Re: [3/3] hwmon: iio_hwmon: defer probe when no channel is found
Date Thu, 30 Jun 2016 17:00:01 +0200
Message-ID <rPLBD-2p3-1@gated-at.bofh.it> (permalink)
References <rOWpr-4kK-21@gated-at.bofh.it> <rPB9f-4uT-7@gated-at.bofh.it> <rPKFB-1Pr-91@gated-at.bofh.it>
X-Original-To Jonathan Cameron <jic23@jic23.retrosnub.co.uk>, Quentin Schulz <quentin.schulz@free-electrons.com>
Dkim-Signature v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=roeck-us.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject; bh=Y17phxkB09eAjS+isPFwtWHvUe2Ut4NPo3rU3c5XE+0=; b=Lr3FarC1Yqni6C6dfilgQ5LfzM NCDeZuKLHj0IdvGk2citPnNTpXbtw9KHolZYUeZ85vp+e49xwhboHmyf46AL0EJP0c7rOQrZkJlNJ RpUYC99+5squtfTmLrQswJUo6p+ZABrIPMmBr4aUcPZqZ/H2+4b/RC2lwS2STHNmL8vk5TP621qBz s2t/5wQVkjY5CxFeWRleLN1A72n2Vw2Pr2OvOOJ8LTwxpWXM+dGXly4FWp8XD9JYSqZXjkYHstpzX TttX3vCIfdNN9OxEOeycHIuDDtbKlhLFSYVNg1XDX8B63PYig6AhZbnLnWiF7MxDX/6ox1QQTeILJ 6eYnyRDQ==;
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0
MIME-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Authenticated_Sender linux@roeck-us.net
X-Outgoing-Spam-Status No, score=-1.0
X-Antiabuse This header was added to track abuse, please include it with any abuse report
X-Antiabuse Primary Hostname - bh-25.webhostbox.net
X-Antiabuse Original Domain - vger.kernel.org
X-Antiabuse Originator/Caller UID/GID - [47 12] / [47 12]
X-Antiabuse Sender Address Domain - roeck-us.net
X-Get-Message-Sender-Via bh-25.webhostbox.net: authenticated_id: linux@roeck-us.net
X-Authenticated-Sender bh-25.webhostbox.net: linux@roeck-us.net
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 75
Organization linux.* mail to news gateway
X-Original-Cc jdelvare@suse.com, jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, maxime.ripard@free-electrons.com, wens@csie.org, lee.jones@linaro.org, linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@free-electrons.com, antoine.tenart@free-electrons.com
X-Original-Date Thu, 30 Jun 2016 07:51:00 -0700
X-Original-Message-ID <577531D4.1090106@roeck-us.net>
X-Original-References <1467101897-15946-4-git-send-email-quentin.schulz@free-electrons.com> <20160630034725.GA26484@roeck-us.net> <6FBFD60A-4D68-4B60-AB34-5077BE6BD586@jic23.retrosnub.co.uk>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1434638

Show key headers only | View raw


On 06/30/2016 06:59 AM, Jonathan Cameron wrote:
>
>
> On 30 June 2016 04:47:25 BST, Guenter Roeck <linux@roeck-us.net> wrote:
>> On Tue, Jun 28, 2016 at 10:18:17AM +0200, Quentin Schulz wrote:
>>> iio_channel_get_all returns -ENODEV when it cannot find either
>> phandles and
>>> properties in the Device Tree or channels whose consumer_dev_name
>> matches
>>> iio_hwmon in iio_map_list. The iio_map_list is filled in by iio
>> drivers
>>> which might be probed after iio_hwmon.
>>>
>>> It is better to defer the probe of iio_hwmon if such error is
>> returned by
>>> iio_channel_get_all in order to let a chance to iio drivers to expose
>>> channels in iio_map_list.
>>>
>>> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
>>> ---
>>>   drivers/hwmon/iio_hwmon.c | 5 ++++-
>>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c
>>> index b550ba5..c0da4d9 100644
>>> --- a/drivers/hwmon/iio_hwmon.c
>>> +++ b/drivers/hwmon/iio_hwmon.c
>>> @@ -73,8 +73,11 @@ static int iio_hwmon_probe(struct platform_device
>> *pdev)
>>>   		name = dev->of_node->name;
>>>
>>>   	channels = iio_channel_get_all(dev);
>>> -	if (IS_ERR(channels))
>>> +	if (IS_ERR(channels)) {
>>> +		if (PTR_ERR(channels) == -ENODEV)
>>> +			return -EPROBE_DEFER;
>>
>> The problem, as I see it, is with iio, which should return
>> -EPROBE_DEFER
>> in this situation.
> Agreed. New fangled stuff this deferred probing :)
>>
>> We can not convert -ENODEV to -EPROBE_DEFER without risking that the
>> channels are _really_ not there, which would result in endless
>> "deferred"
>> messages.
> Hmm not entirely sure how we prevent that happening wherever it is done..
>

Outch. Better at the source, though. I didn't look at the iio code recently,
but can you detect the defer situation at least with devicetree ?

For non-devicetree situations, the only option I can think of would be
to replace the module initcall with a later initcall. That should solve
the problem if both iio_hwmon and and underlying drivers are built
into the kernel. If iio_hwmon is modular, the only real option I can
see is to make sure that all drivers it needs are loaded first.

Does this make sense ?

Guenter

>>
>> Guenter
>>
>>>   		return PTR_ERR(channels);
>>> +	}
>>>
>>>   	st = devm_kzalloc(dev, sizeof(*st), GFP_KERNEL);
>>>   	if (st == NULL) {
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3/3] hwmon: iio_hwmon: defer probe when no channel is found Quentin Schulz <quentin.schulz@free-electrons.com> - 2016-06-28 10:20 +0200
  Re: [3/3] hwmon: iio_hwmon: defer probe when no channel is found Guenter Roeck <linux@roeck-us.net> - 2016-06-30 05:50 +0200
    Re: [3/3] hwmon: iio_hwmon: defer probe when no channel is found Jonathan Cameron <jic23@jic23.retrosnub.co.uk> - 2016-06-30 16:00 +0200
      Re: [3/3] hwmon: iio_hwmon: defer probe when no channel is found Guenter Roeck <linux@roeck-us.net> - 2016-06-30 17:00 +0200
        Re: [3/3] hwmon: iio_hwmon: defer probe when no channel is found Jonathan Cameron <jic23@kernel.org> - 2016-07-03 12:50 +0200
          Re: [3/3] hwmon: iio_hwmon: defer probe when no channel is found Guenter Roeck <linux@roeck-us.net> - 2016-07-03 17:50 +0200
      Re: [3/3] hwmon: iio_hwmon: defer probe when no channel is found Lars-Peter Clausen <lars@metafoo.de> - 2016-06-30 17:00 +0200

csiph-web