All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben@simtec.co.uk>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] HWMON: S3C24XX series ADC driver
Date: Thu, 28 May 2009 15:21:34 +0000	[thread overview]
Message-ID: <4A1EABFE.9050209@simtec.co.uk> (raw)
In-Reply-To: <20090520215029.692678819@fluff.org.uk>

Jean Delvare wrote:
> Hi Ben,
> 

[snip]

>> +	struct device		*hwmon_dev;
>> +
>> +	struct sensor_device_attribute *in_attr[8];
> 
> What is the benefit of allocating these attributes dynamically? You are
> likely to fragment your memory and require ugly code to make it work.

I suppose if we're only looking at producing a single in
or in and label attribute then it is only 24+name bytes
for each attribute.

[snip]

>> +static int s3c_hwmon_create_attr(struct s3c_hwmon *hwmon,
>> +				 struct s3c_hwmon_pdata *pdata,
>> +				 int channel)
>> +{
>> +	struct s3c_hwmon_chcfg *cfg = pdata->in[channel];
>> +	struct sensor_device_attribute *attr;
>> +	const char *name;
>> +
>> +	if (!cfg)
>> +		return 0;
>> +
>> +	attr = kzalloc(sizeof(*attr) + MAX_LABEL, GFP_KERNEL);
>> +	if (attr = NULL)
>> +		return -ENOMEM;
>> +
>> +	if (cfg->name)
>> +		name = cfg->name;
>> +	else {
>> +		name = (char *)(attr+1);
>> +		snprintf((char *)(attr+1), MAX_LABEL, "in_%d", channel);
> 
> This name doesn't match what is described in
> Documentation/hwmon/sysfs-interface, which means that your driver won't
> work with libsensors. This is a blocker.

Ah, having re-read it, it seems the name should go in in%d_label sysfs 
field as well as changing in_%d to in%d_input.

Ben Dooks, Software Engineer, Simtec Electronics

http://www.simtec.co.uk/

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

  parent reply	other threads:[~2009-05-28 15:21 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-20 21:50 [lm-sensors] HWMON: S3C24XX series ADC driver Ben Dooks
2009-05-25  9:39 ` Ramax Lo
2009-05-26  8:01 ` Ben Dooks
2009-05-26  8:07 ` Ben Dooks
2009-05-26 15:08 ` Hector Oron
2009-05-26 19:20 ` Hector Oron
2009-05-26 21:25 ` Ben Dooks
2009-05-27 20:01 ` Jean Delvare
2009-05-28 11:22 ` Ben Dooks
2009-05-28 11:47 ` Jean Delvare
2009-05-28 13:16 ` Ben Dooks
2009-05-28 15:21 ` Ben Dooks [this message]
2009-05-28 15:55 ` Jean Delvare
2009-05-28 20:42 ` Ben Dooks
2009-05-30 12:41 ` Jean Delvare
2009-05-30 13:47 ` Ben Dooks
2009-05-30 14:53 ` Jean Delvare
2009-05-30 15:43 ` Ben Dooks
2009-06-03 10:14 ` Hector Oron
2009-06-08 11:35 ` Ben Dooks
2009-06-10  7:59 ` Jean Delvare
2009-06-12  9:04 ` Ben Dooks
2009-06-12  9:15 ` 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=4A1EABFE.9050209@simtec.co.uk \
    --to=ben@simtec.co.uk \
    --cc=lm-sensors@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.