All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <guenter.roeck@ericsson.com>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: "x86@kernel.org" <x86@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
	Jean Delvare <khali@linux-fr.org>
Subject: Re: [lm-sensors] [PATCH v5 4/5] hwmon: add MAX197 support
Date: Mon, 20 Feb 2012 18:27:02 +0000	[thread overview]
Message-ID: <20120220182702.GA12259@ericsson.com> (raw)
In-Reply-To: <20120210131406.28c3a00b@v0nbox>

On Fri, Feb 10, 2012 at 01:14:06PM -0500, Vivien Didelot wrote:
> Le Fri, 10 Feb 2012 08:15:38 -0800,
> Guenter Roeck <guenter.roeck@ericsson.com> a écrit :
> 
> > Vivien,
> > 
> > On Fri, Feb 10, 2012 at 11:07:55AM -0500, Vivien Didelot wrote:
> > > Hi,
> > > 
> > > On Mon, 6 Feb 2012 12:46:04 -0800,
> > > Guenter Roeck <guenter.roeck@ericsson.com> wrote:
> > > 
> > > > On Mon, 2012-02-06 at 15:15 -0500, Vivien Didelot wrote:
> > > > [ ... ]
> > > > > 
> > > > > BTW, about the TS-5500 ADC part, is a platform ts5500_adc.c
> > > > > file the better solution, or should the device be declared in
> > > > > the ts5500.c platform code?
> > > > > 
> > > > I would suggest to declare it in the ts5500.c platform code. That
> > > > seems to be the common approach as far as I can see.
> > > > 
> > > > platform_add_devices() works pretty well for this. It saves you
> > > > from having to call platform_device_register() for each device
> > > > separately. Obviously that only works if all devices are declared
> > > > in a single file.
> > > 
> > > As the LED is registered using the leds_class, I think
> > > platform_add_devices() couldn't be used here.
> > > 
> > > Lots of platform codes don't check the returned
> > > value of platform_add_devices(). Should we care about a LED or ADC
> > > registration failure (is the following snippet OK?)?
> > > 
> > >     static int __init ts5500_init(void)
> > >     {
> > >     [...]
> > >         pdev = platform_device_register_simple("ts5500", -1, NULL,
> > > 0); if (IS_ERR(pdev)) {
> > >                 ret = PTR_ERR(pdev);
> > >                 goto release_mem;
> > >         }
> > >         platform_set_drvdata(pdev, ts5500);
> > >     
> > >         ret = sysfs_create_group(&pdev->dev.kobj,
> > >                                  &ts5500_attr_group);
> > >         if (ret)
> > >                 goto release_pdev;
> > >     
> > >         led_classdev_register(&pdev->dev, &ts5500_led_cdev);
> > >         if (ts5500->adc) {
> > >                 ts5500_adc_pdev.dev.parent = &pdev->dev;
> > >                 platform_device_register(&ts5500_adc_pdev);
> > >         }
> > >     
> > I didn't look at other code, but personally I try to be consistent.
> > Why do you check the return value from
> > platform_device_register_simple() above, but not the return code from
> > platform_device_register() ? That does not seem to be very consistent
> > to me.
> 
> I check the platform_device_register_simple() returned value because it
> is the platform itself, while the others are on-board devices. I
> thought that it is not a big deal if their registrations failed but the
> platform registration succeeded. Maybe I'm wrong and I should check
> everything.
> 
Hmm .. seems to make sense. Ok with me. Only question is if you would want
to have it fail silently or issue a log message (possibly debug) to report
the failure.

Guenter

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <guenter.roeck@ericsson.com>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Cc: "x86@kernel.org" <x86@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
	Jean Delvare <khali@linux-fr.org>
Subject: Re: [PATCH v5 4/5] hwmon: add MAX197 support
Date: Mon, 20 Feb 2012 10:27:02 -0800	[thread overview]
Message-ID: <20120220182702.GA12259@ericsson.com> (raw)
In-Reply-To: <20120210131406.28c3a00b@v0nbox>

On Fri, Feb 10, 2012 at 01:14:06PM -0500, Vivien Didelot wrote:
> Le Fri, 10 Feb 2012 08:15:38 -0800,
> Guenter Roeck <guenter.roeck@ericsson.com> a écrit :
> 
> > Vivien,
> > 
> > On Fri, Feb 10, 2012 at 11:07:55AM -0500, Vivien Didelot wrote:
> > > Hi,
> > > 
> > > On Mon, 6 Feb 2012 12:46:04 -0800,
> > > Guenter Roeck <guenter.roeck@ericsson.com> wrote:
> > > 
> > > > On Mon, 2012-02-06 at 15:15 -0500, Vivien Didelot wrote:
> > > > [ ... ]
> > > > > 
> > > > > BTW, about the TS-5500 ADC part, is a platform ts5500_adc.c
> > > > > file the better solution, or should the device be declared in
> > > > > the ts5500.c platform code?
> > > > > 
> > > > I would suggest to declare it in the ts5500.c platform code. That
> > > > seems to be the common approach as far as I can see.
> > > > 
> > > > platform_add_devices() works pretty well for this. It saves you
> > > > from having to call platform_device_register() for each device
> > > > separately. Obviously that only works if all devices are declared
> > > > in a single file.
> > > 
> > > As the LED is registered using the leds_class, I think
> > > platform_add_devices() couldn't be used here.
> > > 
> > > Lots of platform codes don't check the returned
> > > value of platform_add_devices(). Should we care about a LED or ADC
> > > registration failure (is the following snippet OK?)?
> > > 
> > >     static int __init ts5500_init(void)
> > >     {
> > >     [...]
> > >         pdev = platform_device_register_simple("ts5500", -1, NULL,
> > > 0); if (IS_ERR(pdev)) {
> > >                 ret = PTR_ERR(pdev);
> > >                 goto release_mem;
> > >         }
> > >         platform_set_drvdata(pdev, ts5500);
> > >     
> > >         ret = sysfs_create_group(&pdev->dev.kobj,
> > >                                  &ts5500_attr_group);
> > >         if (ret)
> > >                 goto release_pdev;
> > >     
> > >         led_classdev_register(&pdev->dev, &ts5500_led_cdev);
> > >         if (ts5500->adc) {
> > >                 ts5500_adc_pdev.dev.parent = &pdev->dev;
> > >                 platform_device_register(&ts5500_adc_pdev);
> > >         }
> > >     
> > I didn't look at other code, but personally I try to be consistent.
> > Why do you check the return value from
> > platform_device_register_simple() above, but not the return code from
> > platform_device_register() ? That does not seem to be very consistent
> > to me.
> 
> I check the platform_device_register_simple() returned value because it
> is the platform itself, while the others are on-board devices. I
> thought that it is not a big deal if their registrations failed but the
> platform registration succeeded. Maybe I'm wrong and I should check
> everything.
> 
Hmm .. seems to make sense. Ok with me. Only question is if you would want
to have it fail silently or issue a log message (possibly debug) to report
the failure.

Guenter

  reply	other threads:[~2012-02-20 18:27 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-01 21:05 [lm-sensors] [PATCH v5 0/5] Support for the TS-5500 platform Vivien Didelot
2012-02-01 21:05 ` Vivien Didelot
2012-02-01 21:05 ` [lm-sensors] [PATCH v5 1/5] x86/platform: (TS-5500) add platform base support Vivien Didelot
2012-02-01 21:05   ` Vivien Didelot
2012-02-01 21:05 ` [lm-sensors] [PATCH v5 2/5] x86/platform: (TS-5500) add GPIO support Vivien Didelot
2012-02-01 21:05   ` Vivien Didelot
2012-02-01 21:30   ` [lm-sensors] " Alan Cox
2012-02-01 21:30     ` Alan Cox
2012-02-02 19:33     ` [lm-sensors] " Guenter Roeck
2012-02-02 19:33       ` Guenter Roeck
2012-02-06 15:37       ` [lm-sensors] " Mark Brown
2012-02-06 15:37         ` Mark Brown
2012-02-06 20:23         ` [lm-sensors] " Vivien Didelot
2012-02-06 20:23           ` Vivien Didelot
2012-02-07 11:13           ` [lm-sensors] " Mark Brown
2012-02-07 11:13             ` Mark Brown
2012-02-06 15:16   ` [lm-sensors] " Mark Brown
2012-02-06 15:16     ` Mark Brown
2012-02-01 21:05 ` [lm-sensors] [PATCH v5 3/5] x86/platform: (TS-5500) add LED support Vivien Didelot
2012-02-01 21:05   ` Vivien Didelot
2012-02-01 21:05 ` [lm-sensors] [PATCH v5 4/5] hwmon: add MAX197 support Vivien Didelot
2012-02-01 21:05   ` Vivien Didelot
2012-02-01 21:35   ` [lm-sensors] " Guenter Roeck
2012-02-01 21:35     ` Guenter Roeck
2012-02-06 20:15     ` [lm-sensors] " Vivien Didelot
2012-02-06 20:15       ` Vivien Didelot
2012-02-06 20:46       ` [lm-sensors] " Guenter Roeck
2012-02-06 20:46         ` Guenter Roeck
2012-02-10 16:07         ` [lm-sensors] " Vivien Didelot
2012-02-10 16:07           ` Vivien Didelot
2012-02-10 16:15           ` [lm-sensors] " Guenter Roeck
2012-02-10 16:15             ` Guenter Roeck
2012-02-10 18:14             ` [lm-sensors] " Vivien Didelot
2012-02-10 18:14               ` Vivien Didelot
2012-02-20 18:27               ` Guenter Roeck [this message]
2012-02-20 18:27                 ` Guenter Roeck
2012-02-20 19:56                 ` [lm-sensors] " Vivien Didelot
2012-02-20 19:56                   ` Vivien Didelot
2012-02-01 21:05 ` [lm-sensors] [PATCH v5 5/5] x86/platform: (TS-5500) add ADC support Vivien Didelot
2012-02-01 21:05   ` Vivien Didelot

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=20120220182702.GA12259@ericsson.com \
    --to=guenter.roeck@ericsson.com \
    --cc=hpa@zytor.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lm-sensors@lm-sensors.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vivien.didelot@savoirfairelinux.com \
    --cc=x86@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.