public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Jon Smirl <jonsmirl@gmail.com>
Cc: linuxppc-dev@ozlabs.org, i2c@lm-sensors.org,
	linux-kernel@vger.kernel.org
Subject: Re: [i2c] [PATCH 1/5] Implement module aliasing for i2c to translate from device tree names
Date: Sun, 13 Jan 2008 15:41:14 +0100	[thread overview]
Message-ID: <20080113154114.4a1c5166@hyperion.delvare> (raw)
In-Reply-To: <9e4733910801120826haa8905dk863ed1c8e9f420c9@mail.gmail.com>

Hi Jon,

On Sat, 12 Jan 2008 11:26:34 -0500, Jon Smirl wrote:
> The common scheme used elsewhere in the kernel for handling more than
> one device in a single driver is aliases. The i2c code's existing
> driver_name/type combination is a different way of implementing the
> same feature. But there is no real need for driver_name/type on any
> platform if aliases are used. Back in version 10 or 11 I had code in
> there which replaced the two fields with aliases on all platforms but
> too many people objected so I removed it..

While I agree that aliases make i2c_client.driver_name obsolete,
i2c_client.type is still needed. Not for device/driver matching in the
kernel, granted, but for device identification from userspace. This is
a first problem your patch has: when using your aliasing mechanism, the
type string is left empty. i2c-core exports this value to user-space
via the "name" sysfs attribute, and some libraries and applications
make use of it. I know of libsensors at least, but I guess there are
more. I can't apply your patch until this problem is solved, otherwise
we would break some user-space applications.

> IMHO, driver_name/type should be removed in new style drivers and
> replaced with aliases on all platforms since aliases are the standard
> kernel mechanism.

I agree. But we can take your aliasing code now (once you have
addressed the issues I raised) and convert the users of driver_name
later; it doesn't have to be done all at once.

The second problem I have with your patch is that you make use of the
driver_name field, while I ultimately want to get rid of it. I'd rather
see you use a different field for aliases, so that the later removal of
the driver_name field and the associated mechanism is easier.

A third, related problem, is the contents of the modalias file when
using your patch. When I tested on my ADM1032 evaluation board, the
modalias contained "adm1032". This isn't a valid module alias string:
"modprobe adm1032" doesn't work. What works is "modprobe i2c:Nadm1032"
so the modalias file should contain "i2c:Nadm1032". Just take a look at
all modalias files in /sys, they all include the subsystem prefix and a
simple modprobe `cat modalias` loads the required driver. I fail to see
why the i2c subsystem would be different.

I said this is related to the second problem because right now,
i2c-core can't easily differentiate between driver names and aliases,
as both are stored in i2c_client.driver_name. Having separate fields
would make it possible (and relatively easy) to add the required prefix
before aliases but not before driver names. The only drawback is that
it will increase the size of the i2c_client structure, but I do not
care that much given that it is only temporary.

-- 
Jean Delvare

  reply	other threads:[~2008-01-13 14:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20071220044136.20091.70984.stgit@terra.home>
2007-12-27 16:47 ` [PATCH 0/5] Version 17, series to add device tree naming to i2c Jon Smirl
2007-12-28 12:14   ` Jean Delvare
     [not found] ` <20071220044136.20091.70984.stgit-+J+k29bDNxlBDLzU/O5InQ@public.gmane.org>
2008-01-10 14:14   ` Jon Smirl
     [not found]     ` <9e4733910801100614y7522a573qb2af41a714b08d5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-01-10 16:14       ` Jean Delvare
2008-01-11  8:56 ` [i2c] " Jean Delvare
2008-01-11 15:52   ` Jon Smirl
2008-01-11 16:05     ` Jochen Friedrich
2008-01-11 19:15     ` Jean Delvare
2008-01-11 20:16       ` Jon Smirl
2008-01-12  9:08         ` Jean Delvare
2008-01-12 16:00           ` Jon Smirl
2008-01-13 15:09             ` Jean Delvare
     [not found] ` <20071220044138.20091.31417.stgit@terra.home>
2008-01-11 19:20   ` [i2c] [PATCH 1/5] Implement module aliasing for i2c to translate from device tree names Jean Delvare
2008-01-12  8:46     ` Jean Delvare
2008-01-12 16:26       ` Jon Smirl
2008-01-13 14:41         ` Jean Delvare [this message]
2008-01-13 16:24           ` Jon Smirl
2008-01-13 17:40             ` Jean Delvare
     [not found]               ` <20080113184017.7e3b409f-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-13 18:01                 ` Jon Smirl
2008-01-13 18:45                   ` Jean Delvare
     [not found]                     ` <20080113194523.51683e97-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-13 18:50                       ` Jon Smirl
2008-01-13 19:05                         ` Jean Delvare

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=20080113154114.4a1c5166@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=i2c@lm-sensors.org \
    --cc=jonsmirl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox