public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <m.chehab@samsung.com>
To: Antti Palosaari <crope@iki.fi>
Cc: linux-media@vger.kernel.org, Nibble Max <nibble.max@gmail.com>,
	Olli Salonen <olli.salonen@iki.fi>,
	Evgeny Plehov <EvgenyPlehov@ukr.net>
Subject: Re: [GIT PULL FINAL 16/21] m88ts2022: rename device state (priv => s)
Date: Wed, 03 Sep 2014 07:38:23 -0300	[thread overview]
Message-ID: <20140903073823.54daad9b.m.chehab@samsung.com> (raw)
In-Reply-To: <54067C6D.8090804@iki.fi>

Em Wed, 03 Sep 2014 05:26:53 +0300
Antti Palosaari <crope@iki.fi> escreveu:

> 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.

Yeah, on v4l2, we generally use 'dev' for such struct on several drivers.
Yet, it looks confusing, especially when some part of the code needs to
work with the private structure and struct device.

So, we end having things like dev->udev->dev inside them, with looks
ugly, IMHO.

> 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.

No, it is as easy as running a one line command, as you can use git
filter-branch. I generally use it like:
	$ git filter-branch -f --msg-filter 'cat && sed s,foo,bar,g' patchwork..topic/r820t
To replace something at the comment (or to add a new comment), but I
used it already to automatically change some vars at replace.

You could also try to use the bfg[1].

Yet, one of problems of using 's' as a name is that seeking for it could
match something different. So, you'll likely need to use \bs\b as the
regex expression and likely review it.

[1] http://rtyley.github.io/bfg-repo-cleaner/

Another way of doing it is to export all patches to a directory
with:
	$ mkdir patches
	$ git format-patch -o patches some_base_branch..

then you can run a command to replace them like (untested):
	$ for i in `quilt series`; do sed -r 's,\bs\b,state,g' <$i >a && mv a $i; done

and then reapply on another branch with:

	$ git am --directory patches 

Btw, this revels another problem with names that are not unique
(like "dev") or too short, like "s": if later need to do some changes
or seek for all occurrences of such var, it could become a real pain.

Regards,
Mauro

  reply	other threads:[~2014-09-03 10:38 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-22 10:57 [GIT PULL FINAL 00/21] misc DTV stuff for 3.18 Antti Palosaari
2014-08-22 10:57 ` [GIT PULL FINAL 01/21] si2168: clean logging Antti Palosaari
2014-08-22 11:47   ` Mauro Carvalho Chehab
2014-08-22 12:13     ` Antti Palosaari
2014-08-22 12:28       ` Mauro Carvalho Chehab
2014-08-22 12:50         ` Antti Palosaari
2014-08-22 13:41           ` Mauro Carvalho Chehab
2014-08-22 10:57 ` [GIT PULL FINAL 02/21] si2157: " Antti Palosaari
2014-08-22 10:57 ` [GIT PULL FINAL 03/21] m88ds3103: implement set voltage and TS clock Antti Palosaari
2014-08-22 10:57 ` [GIT PULL FINAL 04/21] si2168: add ts_mode setting and move to si2168_init Antti Palosaari
2014-08-22 10:57 ` [GIT PULL FINAL 05/21] em28xx: add ts mode setting for PCTV 292e Antti Palosaari
2014-08-22 10:57 ` [GIT PULL FINAL 06/21] cxusb: add ts mode setting for TechnoTrend CT2-4400 Antti Palosaari
2014-08-22 10:57 ` [GIT PULL FINAL 07/21] sp2: Add I2C driver for CIMaX SP2 common interface module Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 08/21] cxusb: Add support for TechnoTrend TT-connect CT2-4650 CI Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 09/21] cxusb: Add read_mac_address for TT CT2-4400 and CT2-4650 Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 10/21] si2168: DVB-T2 PLP selection implemented Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 11/21] si2157: Add support for delivery system SYS_ATSC Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 12/21] dvb-usb-v2: remove dvb_usb_device NULL check Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 13/21] msi2500: remove unneeded local pointer on msi2500_isoc_init() Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 14/21] m88ts2022: fix 32bit overflow on filter calc Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 15/21] m88ts2022: fix coding style issues Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 16/21] m88ts2022: rename device state (priv => s) Antti Palosaari
2014-09-02 18:51   ` Mauro Carvalho Chehab
2014-09-03  2:26     ` Antti Palosaari
2014-09-03 10:38       ` Mauro Carvalho Chehab [this message]
2014-09-03 10:50         ` Antti Palosaari
2014-09-03 11:47           ` Mauro Carvalho Chehab
2014-08-22 10:58 ` [GIT PULL FINAL 17/21] m88ts2022: clean up logging Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 18/21] m88ts2022: convert to RegMap I2C API Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 19/21] m88ts2022: change parameter type of m88ts2022_cmd Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 20/21] m88ds3103: change .set_voltage() implementation Antti Palosaari
2014-08-22 10:58 ` [GIT PULL FINAL 21/21] m88ds3103: fix coding style issues Antti Palosaari
2014-08-22 11:08 ` [GIT PULL FINAL 00/21] misc DTV stuff for 3.18 Antti Palosaari
2014-09-02 18:59 ` Mauro Carvalho Chehab

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=20140903073823.54daad9b.m.chehab@samsung.com \
    --to=m.chehab@samsung.com \
    --cc=EvgenyPlehov@ukr.net \
    --cc=crope@iki.fi \
    --cc=linux-media@vger.kernel.org \
    --cc=nibble.max@gmail.com \
    --cc=olli.salonen@iki.fi \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox