From: f.fainelli@gmail.com (Florian Fainelli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH net-next v2 05/10] drivers: base: Add device_find_class()
Date: Sat, 14 Jan 2017 11:01:14 -0800 [thread overview]
Message-ID: <0f5e5265-b116-286c-4d72-3aaa72ae83ac@gmail.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DB02620D3@AcuExch.aculab.com>
On 01/13/2017 02:55 AM, David Laight wrote:
> From: Florian Fainelli
>> Sent: 12 January 2017 22:51
>> On 01/12/2017 01:21 PM, David Miller wrote:
>>> From: Florian Fainelli <f.fainelli@gmail.com>
>>> Date: Wed, 11 Jan 2017 19:41:16 -0800
>>>
>>>> Add a helper function to lookup a device reference given a class name.
>>>> This is a preliminary patch to remove adhoc code from net/dsa/dsa.c and
>>>> make it more generic.
> ...
>>>> +static int dev_is_class(struct device *dev, void *class)
>>>
>>> I know you are just moving code, but this class argumnet is a string
>>> and thus should be "char *" or even "const char *".
>>
>> Well, this is really so that we don't need to cast the arguments passed
>> to device_find_child(), which takes a void *data as well. If we made
>> that a const char *class, we'd get warnings that look like these:
>>
>> drivers/base/core.c: In function 'device_find_class':
>> drivers/base/core.c:2083:2: warning: passing argument 2 of
>> 'device_find_child' discards 'const' qualifier from pointer target type
>> [enabled by default]
>> return device_find_child(parent, class, dev_is_class);
>> ^
>> drivers/base/core.c:2050:16: note: expected 'void *' but argument is of
>> type 'const char *'
>> struct device *device_find_child(struct device *parent, void *data,
>> ^
> ...
>
> Maybe device_find_child() needs changing to take 'const void *' ?
As a separate patch set, sure, I will add that to my TODO. Thanks!
--
Florian
WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>,
David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"jason@lakedaemon.net" <jason@lakedaemon.net>,
"andrew@lunn.ch" <andrew@lunn.ch>,
"sebastian.hesselbarth@gmail.com"
<sebastian.hesselbarth@gmail.com>,
"gregory.clement@free-electrons.com"
<gregory.clement@free-electrons.com>,
"linux@armlinux.org.uk" <linux@armlinux.org.uk>,
"vivien.didelot@savoirfairelinux.com"
<vivien.didelot@savoirfairelinux.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Subject: Re: [PATCH net-next v2 05/10] drivers: base: Add device_find_class()
Date: Sat, 14 Jan 2017 11:01:14 -0800 [thread overview]
Message-ID: <0f5e5265-b116-286c-4d72-3aaa72ae83ac@gmail.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DB02620D3@AcuExch.aculab.com>
On 01/13/2017 02:55 AM, David Laight wrote:
> From: Florian Fainelli
>> Sent: 12 January 2017 22:51
>> On 01/12/2017 01:21 PM, David Miller wrote:
>>> From: Florian Fainelli <f.fainelli@gmail.com>
>>> Date: Wed, 11 Jan 2017 19:41:16 -0800
>>>
>>>> Add a helper function to lookup a device reference given a class name.
>>>> This is a preliminary patch to remove adhoc code from net/dsa/dsa.c and
>>>> make it more generic.
> ...
>>>> +static int dev_is_class(struct device *dev, void *class)
>>>
>>> I know you are just moving code, but this class argumnet is a string
>>> and thus should be "char *" or even "const char *".
>>
>> Well, this is really so that we don't need to cast the arguments passed
>> to device_find_child(), which takes a void *data as well. If we made
>> that a const char *class, we'd get warnings that look like these:
>>
>> drivers/base/core.c: In function 'device_find_class':
>> drivers/base/core.c:2083:2: warning: passing argument 2 of
>> 'device_find_child' discards 'const' qualifier from pointer target type
>> [enabled by default]
>> return device_find_child(parent, class, dev_is_class);
>> ^
>> drivers/base/core.c:2050:16: note: expected 'void *' but argument is of
>> type 'const char *'
>> struct device *device_find_child(struct device *parent, void *data,
>> ^
> ...
>
> Maybe device_find_child() needs changing to take 'const void *' ?
As a separate patch set, sure, I will add that to my TODO. Thanks!
--
Florian
next prev parent reply other threads:[~2017-01-14 19:01 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-12 3:41 [PATCH net-next v2 00/10] net: dsa: Support for pdata in dsa2 Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` [PATCH net-next v2 01/10] net: dsa: Pass device pointer to dsa_register_switch Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` [PATCH net-next v2 02/10] net: dsa: Make most functions take a dsa_port argument Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` [PATCH net-next v2 03/10] net: dsa: Suffix function manipulating device_node with _dn Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` [PATCH net-next v2 04/10] net: dsa: Move ports assignment closer to error checking Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` [PATCH net-next v2 05/10] drivers: base: Add device_find_class() Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 21:21 ` David Miller
2017-01-12 21:21 ` David Miller
2017-01-12 22:50 ` Florian Fainelli
2017-01-12 22:50 ` Florian Fainelli
2017-01-13 4:16 ` David Miller
2017-01-13 4:16 ` David Miller
2017-01-13 10:55 ` David Laight
2017-01-13 10:55 ` David Laight
2017-01-14 19:01 ` Florian Fainelli [this message]
2017-01-14 19:01 ` Florian Fainelli
2017-01-12 3:41 ` [PATCH net-next v2 06/10] net: dsa: Migrate to device_find_class() Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` [PATCH net-next v2 07/10] net: Relocate dev_to_net_device() into core Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` [PATCH net-next v2 08/10] net: dsa: Add support for platform data Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-13 14:04 ` Andrew Lunn
2017-01-13 14:04 ` Andrew Lunn
2017-01-13 22:37 ` Florian Fainelli
2017-01-13 22:37 ` Florian Fainelli
2017-01-14 19:12 ` Florian Fainelli
2017-01-14 19:12 ` Florian Fainelli
2017-01-13 14:11 ` Andrew Lunn
2017-01-13 14:11 ` Andrew Lunn
2017-01-13 22:39 ` Florian Fainelli
2017-01-13 22:39 ` Florian Fainelli
2017-01-12 3:41 ` [PATCH net-next v2 09/10] net: phy: Allow pre-declaration of MDIO devices Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-12 3:41 ` [PATCH net-next v2 10/10] ARM: orion: Register DSA switch as a MDIO device Florian Fainelli
2017-01-12 3:41 ` Florian Fainelli
2017-01-13 2:34 ` [PATCH net-next v2 00/10] net: dsa: Support for pdata in dsa2 Vivien Didelot
2017-01-13 2:34 ` Vivien Didelot
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=0f5e5265-b116-286c-4d72-3aaa72ae83ac@gmail.com \
--to=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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 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.