linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Jean Delvare <jdelvare@suse.com>
Cc: "Wolfram Sang" <wsa@the-dreams.de>,
	"Michał Kępień" <kernel@kempniu.pl>,
	"Steven Honeyman" <stevenhoneyman@gmail.com>,
	"Valdis Kletnieks" <Valdis.Kletnieks@vt.edu>,
	"Jochen Eisinger" <jochen@penguin-breeder.org>,
	"Gabriele Mazzotta" <gabriele.mzt@gmail.com>,
	"Andy Lutomirski" <luto@kernel.org>,
	"Mario Limonciello" <Mario_Limonciello@dell.com>,
	"Alex Hung" <alex.hung@canonical.com>,
	"Takashi Iwai" <tiwai@suse.de>,
	linux-i2c <linux-i2c@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Platform Driver" <platform-driver-x86@vger.kernel.org>
Subject: Re: [PATCH v2] i2c: i801: Register optional lis3lv02d i2c device on Dell machines
Date: Tue, 13 Feb 2018 17:50:23 +0100	[thread overview]
Message-ID: <20180213165023.xmzovx7fd3gdljxw@pali> (raw)
In-Reply-To: <CAHp75VfxgbFiDxyrqyMRE8s85L1_EzkVvrA1NGYA5_su=5oGVQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3731 bytes --]

On Tuesday 13 February 2018 17:06:19 Andy Shevchenko wrote:
> On Tue, Feb 13, 2018 at 5:00 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> > On Tuesday 13 February 2018 16:55:00 Andy Shevchenko wrote:
> >> On Mon, Feb 12, 2018 at 5:30 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> >> > On Wednesday 31 January 2018 14:27:51 Andy Shevchenko wrote:
> >> >> On Wed, Jan 31, 2018 at 2:03 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> >> >> > On Sunday 28 January 2018 17:00:35 Andy Shevchenko wrote:
> >> >> >> On Sun, Jan 28, 2018 at 4:45 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> >> >>
> >> >> >> > ACPI device name is SMO8800, SMO8810, ... Will that acpi_dev_present
> >> >> >> > function match only prefix and not exact string?
> >> >> >>
> >> >> >> OK, fair enough.
> >> >> >>
> >> >> >> Do we have more users of such pattern?
> >> >> >
> >> >> > I have not seen this ACPI pattern yet, so probably not.
> >> >>
> >> >> I see. So, my  one concern is the implicit names of the devices. I
> >> >> would like rather to see
> >> >>
> >> >> ... acpi_device_id ... []= {
> >> >>  {"SMO8800"},
> >> >>  {"SMO8810"},
> >> >> ...
> >> >> {}
> >> >> };
> >> >
> >> > Following table already exists in dell-smo8800.c file:
> >> >
> >> > static const struct acpi_device_id smo8800_ids[] = {
> >> >         { "SMO8800", 0 },
> >> >         { "SMO8801", 0 },
> >> >         { "SMO8810", 0 },
> >> >         { "SMO8811", 0 },
> >> >         { "SMO8820", 0 },
> >> >         { "SMO8821", 0 },
> >> >         { "SMO8830", 0 },
> >> >         { "SMO8831", 0 },
> >> >         { "", 0 },
> >> > };
> >> >
> >> > MODULE_DEVICE_TABLE(acpi, smo8800_ids);
> >> >
> >> > Can we reuse it?
> >>
> >> >  Maybe moving array smo8800_ids[] into some header file
> >> > (which one?) and statically inline it?
> >>
> >> Bad idea.
> >>
> >> > Or having it only in
> >> > dell-smo8800.c file and exporting its symbol?
> >>
> >> Even worse.
> >>
> >> > Or is there better idea?
> >> >
> >> > For sure I do not want to copy paste this table into another module and
> >> > maintaining two copies of this list.
> >>
> >> The copy is fine. Can you guarantee that those two lists would be
> >> always the same? I'm not.
> >
> > Me neither.
> >
> >> And besides that explicitly over implicitly  is a really good thing. I
> >> would not like to grep for an ID followed by grepping include line and
> >> check each files to check if it uses it or not.
> >
> > So what do you suggest now?
> 
> Copy'n'paste and maintain two lists.
> Yes, it's not the ideal, but working solution.
> 
> You may put a comment before each list to explain what the second does
> and tell a contributor to look at it and update if needed.

I'm not maintainer of i2c-i801.ko, Jean Delvare & Wolfram Sang are.
Therefore instructing future contributors would be up to them.

Jean, it is OK?

> > Having one file where it would be defined is a bad idea for you.
> 
> Not just "one file", but "one *header* file". Or "exporting a symbol"
> which is basically not supposed to be exported.
> ID tables are part of the actual drivers, neither headers, nor libraries.

But this is exactly what is needed. This ACPI ID table contains ACPI
names which says if accelerometer is present or not.

> > And maintaining copy of same array in two different files in two
> > different subsystems is something which I cannot guarantee.
> >
> > Therefore the current patch is the best approach.
> 
> I don't like it. I'll not take it, sorry.
> 
> > No shared file with
> > shared array/table and also no copy of that array in two different
> > subsystems.
> 
> 

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2018-02-13 16:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-27 13:32 [PATCH v2] i2c: i801: Register optional lis3lv02d i2c device on Dell machines Pali Rohár
2018-01-28 14:39 ` Andy Shevchenko
2018-01-28 14:45   ` Pali Rohár
2018-01-28 15:00     ` Andy Shevchenko
2018-01-31 12:03       ` Pali Rohár
2018-01-31 12:27         ` Andy Shevchenko
2018-02-12 15:30           ` Pali Rohár
2018-02-13 14:55             ` Andy Shevchenko
2018-02-13 15:00               ` Pali Rohár
2018-02-13 15:06                 ` Andy Shevchenko
2018-02-13 16:50                   ` Pali Rohár [this message]
2018-02-13 17:01                     ` Andy Shevchenko
2018-02-13 17:05                       ` Andy Shevchenko
2018-02-26 20:32                     ` Wolfram Sang
2018-03-08 22:53                       ` Pali Rohár
2018-04-18 11:46                         ` Pali Rohár
2019-04-27  6:48                           ` Pali Rohár
2019-05-28  9:19                       ` Jean Delvare
2019-05-28  9:41                         ` Pali Rohár
2019-05-28  9:50                           ` Jean Delvare
2019-05-28  9:54                             ` Pali Rohár
2019-05-28 10:00                               ` Jean Delvare
2018-02-11 22:03 ` Michał Kępień
2018-02-12 15:25   ` Andy Shevchenko
2019-06-02 13:20 ` [PATCH v3] " Pali Rohár
2019-06-04 14:57   ` Jean Delvare
2019-06-04 22:30     ` Pali Rohár

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=20180213165023.xmzovx7fd3gdljxw@pali \
    --to=pali.rohar@gmail.com \
    --cc=Mario_Limonciello@dell.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=alex.hung@canonical.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=gabriele.mzt@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=jochen@penguin-breeder.org \
    --cc=kernel@kempniu.pl \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=stevenhoneyman@gmail.com \
    --cc=tiwai@suse.de \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).