From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Cc: mkrufky-dJidKbW2IEtAfugRpC6u6w@public.gmane.org,
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: Re: [PATCH 2/6]: i2c-pcf: Add adapter hooks around xfer begin and end.
Date: Thu, 16 Oct 2008 14:57:41 +0200 [thread overview]
Message-ID: <20081016145741.1d94f482@hyperion.delvare> (raw)
In-Reply-To: <20081015.143212.196108134.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Hi David,
On Wed, 15 Oct 2008 14:32:12 -0700 (PDT), David Miller wrote:
> From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Date: Wed, 15 Oct 2008 14:19:14 +0200
>
> > Of course we can start with a local implementation in i2c-algo-pcf and
> > we move it to i2c-core later if needed.
>
> Please let's be practical and handle things this way.
>
> > That's not exactly elegant. I'd rather make .xfer_begin and .xfer_end
> > optional and check for NULL before calling them from pcf_xfer(). That's
> > less intrusive also, you don't even need to touch the individual bus
> > drivers using the i2c-algo-pcf module if they don't need these hooks.
>
> I think it's more elegant to remove as many conditionals from
> generic code as possible.
I see many good reasons to prefer having conditionals in a central
place over empty callback functions in virtually every i2c bus driver.
First reason: I don't expect many drivers to make use of the pre/post
transaction hooks. Given that a test is cheaper than a function call,
overall performance with conditionals should be better. I suspect this
will also make the builds faster and the binary code smaller (although
I'm not going to benchmark it.)
Second reason: with empty callback functions, it's not immediately
obvious which i2c bus drivers use these hooks and which do not. This
case is specific enough that I think there is value in being able to
trace it.
Third reason: changing things in a central place is easier. You may
not think it's important because there is a rather small number of
PCF8454-based bus drivers are the moment, but if we do the same for
i2c-algo-bit, it has no less than 27 users and I don't feel like
changing them all. If the prototype of the hooks ever changes, having
to go through several dozen drivers to update otherwise useless
callback functions sounds plain wrong. Same if we implement the hooks in
i2c-algo-pcf and i2c-algo-bit today and later decide to move them to
i2c-core: having 2 i2c algo drivers to update is fairly easy, having 30
i2c bus drivers to update is much more work.
I'm not sure what are your reasons for preferring empty callback
functions? I can't remember seeing this approach used in any part of
the kernel I touched. And for what it's worth, i2c-core is full of
tests for callback functions, and I can't remember anyone objecting.
--
Jean Delvare
_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c
next prev parent reply other threads:[~2008-10-16 12:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-21 9:43 [PATCH 2/6]: i2c-pcf: Add adapter hooks around xfer begin and end David Miller
[not found] ` <20080821.024322.35962617.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-10-15 12:19 ` Jean Delvare
[not found] ` <20081015141914.7d6c3dd5-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-10-15 21:32 ` David Miller
[not found] ` <20081015.143212.196108134.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
2008-10-16 12:57 ` Jean Delvare [this message]
[not found] ` <20081016145741.1d94f482-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-10-17 11:43 ` Jean Delvare
2008-10-15 21:37 ` Michael Krufky
[not found] ` <48F662A5.4050303-dJidKbW2IEtAfugRpC6u6w@public.gmane.org>
2008-10-16 16:17 ` Jean Delvare
[not found] ` <20081016181707.4878bf31-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-10-16 18:32 ` Michael Krufky
[not found] ` <48F788C0.10300-dJidKbW2IEtAfugRpC6u6w@public.gmane.org>
2008-10-17 11:16 ` 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=20081016145741.1d94f482@hyperion.delvare \
--to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org \
--cc=mkrufky-dJidKbW2IEtAfugRpC6u6w@public.gmane.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