All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Jean Delvare <khali@linux-fr.org>
Cc: Andy Walls <awalls@md.metrocast.net>,
	linux-media@vger.kernel.org, Jarod Wilson <jarod@redhat.com>,
	Janne Grunau <j@jannau.net>
Subject: Re: [PATCH 3/3] lirc_zilog: Remove use of deprecated struct  i2c_adapter.id field
Date: Wed, 05 Jan 2011 20:02:41 -0200	[thread overview]
Message-ID: <4D24EA81.8080205@redhat.com> (raw)
In-Reply-To: <20110105225149.1145420b@endymion.delvare>

Em 05-01-2011 19:51, Jean Delvare escreveu:
> Hi Mauro,
> 
> On Wed, 05 Jan 2011 15:34:28 -0200, Mauro Carvalho Chehab wrote:
>> Hi Jean,
>>
>> Thanks for your acks for patches 1 and 2. I've already applied the patches 
>> on my tree and at linux-next. I'll try to add the acks on it before sending
>> upstream.
> 
> If you can't, it's fine. I merely wanted to show my support to Andy's
> work, I don't care if I'm not counted as a reviewer for these small
> patches.

Ok. So, it is probably better to keep it as-is, to avoid rebasing and having
to wait for a couple days at linux-next before sending the git pull request.

> 
>> Em 05-01-2011 12:45, Jean Delvare escreveu:
>>> From a purely technical perspective, changing client->addr in the
>>> probe() function is totally prohibited.
>>
>> Agreed. Btw, there are some other hacks with client->addr abuse on some 
>> other random places at drivers/media, mostly at the device bridge code, 
>> used to test if certain devices are present and/or to open some I2C gates 
>> before doing some init code. People use this approach as it provides a
>> fast way to do some things. On several cases, the amount of code for
>> doing such hack is very small, when compared to writing a new I2C driver
>> just to do some static initialization code. Not sure what would be the 
>> better approach to fix them.
> 
> Hard to tell without seeing the exact code. Ideally,
> i2c_new_dummy() would cover these cases: you don't need to write an
> actual driver for the device, it's perfectly OK to use the freshly
> instantiated i2c_client from the bridge driver directly. Alternatively,
> i2c_smbus_xfer() or i2c_transfer() can be used for one-time data
> exchange with any slave on the bus as long as you know what you're
> doing (i.e. you know that no i2c_client will ever be instantiated for
> this slave.)
> 
> If you have specific cases you don't know how to solve, please point me
> to them and I'll take a look.

You can take a look at saa7134-cards.c, for example. saa7134_tuner_setup()
has several examples. It starts with this one:

	switch (dev->board) {
	case SAA7134_BOARD_BMK_MPEX_NOTUNER:
	case SAA7134_BOARD_BMK_MPEX_TUNER:
		/* Checks if the device has a tuner at 0x60 addr
		   If the device doesn't have a tuner, TUNER_ABSENT
		   will be used at tuner_type, avoiding loading tuner
		   without needing it
		 */
		dev->i2c_client.addr = 0x60;
		board = (i2c_master_recv(&dev->i2c_client, &buf, 0) < 0)
			? SAA7134_BOARD_BMK_MPEX_NOTUNER
			: SAA7134_BOARD_BMK_MPEX_TUNER;

In this specific case, it is simply a probe for a device at address 0x60, but
there are more complex cases there, with eeprom reads and/or some random init
that happens before actually attaching some driver at the i2c address.
It is known to work, but it sounds like a hack.

Cheers,
Mauro

  reply	other threads:[~2011-01-05 22:03 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1293587067.3098.10.camel@localhost>
2010-12-29  1:46 ` [PATCH 1/3] hdpvr: Add I2C and ir-kdb-i2c registration of the Zilog Z8 IR chip Andy Walls
2010-12-29 11:08   ` Mauro Carvalho Chehab
2010-12-29 13:40     ` Andy Walls
2011-01-05 12:50   ` Jean Delvare
2011-01-05 22:44     ` Andy Walls
2010-12-29  1:47 ` [PATCH 2/3] ir-kbd-i2c: Add HD PVR IR Rx support to ir-kbd-i2c Andy Walls
2010-12-29 11:12   ` Mauro Carvalho Chehab
2010-12-29 14:14     ` Andy Walls
2011-01-05 12:53   ` Jean Delvare
2010-12-29  1:49 ` [PATCH 3/3] lirc_zilog: Remove use of deprecated struct i2c_adapter.id field Andy Walls
2011-01-05 14:45   ` Jean Delvare
2011-01-05 17:34     ` Mauro Carvalho Chehab
2011-01-05 21:51       ` Jean Delvare
2011-01-05 22:02         ` Mauro Carvalho Chehab [this message]
2011-01-06  1:20           ` Andy Walls
2011-01-13  9:46             ` Jean Delvare
2011-01-13 13:31           ` Jean Delvare
2011-01-06  0:46     ` Andy Walls
2011-01-13 13:21       ` Jean Delvare
2011-01-13 14:12         ` Devin Heitmueller
2011-01-13 16:34 Andy Walls
2011-01-13 16:48 ` Jean Delvare
2011-01-13 17:07   ` Devin Heitmueller
2011-01-13 17:19     ` Jean Delvare
2011-01-13 17:04 ` Devin Heitmueller
  -- strict thread matches above, loose matches on Subject: below --
2011-01-13 16:59 Andy Walls

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=4D24EA81.8080205@redhat.com \
    --to=mchehab@redhat.com \
    --cc=awalls@md.metrocast.net \
    --cc=j@jannau.net \
    --cc=jarod@redhat.com \
    --cc=khali@linux-fr.org \
    --cc=linux-media@vger.kernel.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.