[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <63e9dd4b-33c0-a08b-2db1-dea81bdb97ac@denx.de>
Date: Wed, 19 Dec 2018 18:24:53 +0100
From: Marek Vasut <marex@...x.de>
To: Pavel Machek <pavel@...x.de>, Jiri Pirko <jiri@...nulli.us>
Cc: Tristram.Ha@...rochip.com,
Sergio Paracuellos <sergio.paracuellos@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
vivien.didelot@...oirfairelinux.com, UNGLinuxDriver@...rochip.com,
netdev@...r.kernel.org
Subject: Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver
On 12/19/2018 06:22 PM, Pavel Machek wrote:
> On Wed 2018-12-19 17:15:32, Jiri Pirko wrote:
>> Wed, Dec 19, 2018 at 05:08:57PM CET, pavel@...x.de wrote:
>>> Hi!
>>>
>>>>> +static int ksz_i2c_write32(struct ksz_device *dev, u32 reg, u32 value)
>>>>> +{
>>>>> + value = cpu_to_be32(value);
>>>>> + return ksz_i2c_write(dev, reg, &value, 4);
>>>>> +}
>>>>> +
>>>>> +static int ksz_i2c_get(struct ksz_device *dev, u32 reg, void *data, size_t len)
>>>>> +{
>>>>> + return ksz_i2c_read(dev, reg, data, len);
>>>>> +}
>>>>> +
>>>>> +static int ksz_i2c_set(struct ksz_device *dev, u32 reg, void *data, size_t len)
>>>>> +{
>>>>> + return ksz_i2c_write(dev, reg, data, len);
>>>>> +}
>>>>
>>>>
>>>> This header file makes no sense. Please move the functions into .c
>>>
>>> No, that would make code bigger & slower.
>>>
>>> It makes sense to me. But I'd add "inline" keyword to make the goal
>>> explicit.
>>
>> 1) It makes no sense to have header files for things like this. The
>> functions are only used within the single .c file.
>>
>> 2) You cannot inline them, as they are used as ops.
>
> Ok, sorry for the noise.
If you were to use regmap, this whole boilerplate would go away ...
--
Best regards,
Marek Vasut
Powered by blists - more mailing lists