Re: [GIT PULL FINAL 16/21] m88ts2022: rename device state (priv => s)

Antti Palosaari
2014-09-03T02:26:57Z

On 09/02/2014 09:51 PM, Mauro Carvalho Chehab wrote:
> Em Fri, 22 Aug 2014 13:58:08 +0300
> Antti Palosaari <crope@iki.fi> escreveu:
>
>> I like short names for things which are used everywhere overall the
>> driver. Due to that rename device state pointer from 'priv' to 's'.
>
> Please, don't do that. "s" is generally used on several places for string.
> If you want a shorter name, call it "st" for example.

huoh :/
st is not even much better. 'dev' seems to be the 'official' term. I
will start using it. There is one caveat when 'dev' is used as kernel
dev_foo() logging requires pointer to device, which is also called dev.

for USB it is: intf->dev
for PCI it is: pci->dev
for I2C it is: client->dev

And you have to store that also your state in order to use logging (and
usually needed other things too). So for example I2C driver it goes:

struct driver_dev *dev = i2c_get_clientdata(client);
dev_info(&dev->client->dev, "Hello World\n");

Maybe macro needed to shorten that dev_ logging, which takes as a first
parameter pointer to your own driver state.

I have used that 's' for many of my drivers already and there is likely
over 50 patches on my queue which needs to be rebased. And rebasing that
kind of thing for 50 patches is *really* painful, ugh.

Antti