All of lore.kernel.org
 help / color / mirror / Atom feed
From: Narendra K <Narendra_K@dell.com>
To: greg@kroah.com
Cc: netdev@vger.kernel.org, linux-hotplug@vger.kernel.org,
	linux-pci@vger.kernel.org, matt_domsch@dell.com,
	jordan_hargrave@dell.com, charles_rose@dell.com,
	vijay_nijhawan@dell.com
Subject: Re: [PATCH 1/2] Export firmware assigned labels of network devices to sysfs
Date: Wed, 07 Jul 2010 17:48:26 +0000	[thread overview]
Message-ID: <20100707174826.GA1046@auslistsprd01.us.dell.com> (raw)
In-Reply-To: <EDA0A4495861324DA2618B4C45DCB3EE612B27@blrx3m08.blr.amer.dell.com>

> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com] 
> Sent: Wednesday, July 07, 2010 4:52 AM
> To: K, Narendra
> Cc: netdev@vger.kernel.org; linux-hotplug@vger.kernel.org;
> linux-pci@vger.kernel.org; Domsch, Matt; Hargrave, Jordan; Rose,
> Charles; Nijhawan, Vijay
> Subject: Re: [PATCH 1/2] Export firmware assigned labels of network
> devices to sysfs
> 
> On Tue, Jul 06, 2010 at 01:52:18PM -0500, Narendra K wrote:
> > 
> > 'device_create_file' takes 'struct device_attribute *' as a param
> which 
> > we have not used here because  'struct device_attribute' does not have
> .test
> > member which we needed in this patch.
> 
> Why do you need it?  What is calling that function?  What am I missing
> here?

The function 'pci_create_smbiosname_file' below is calling the .test method.
For every pdev the function checks if it has a SMBIOS string associated
with it or not. If there is no string (and instance) associated, then the
attributes 'label' and 'instance' are not created for that pdev.
To check for the existance of the string, the .test method is needed and
it is not available in 'struct device_attribute'. It provides 
.show and .store. We need a .show and .test. So we defined 

+struct smbios_attribute smbios_attr_label = {
+	.attr = {.name = "label", .mode = 0444, .owner = THIS_MODULE},
+	.show = smbiosname_show,
+	.test = smbios_instance_string_exist,
+};

'smbios_instance_string_exist' checks if the pdev has a 'string' and 'instance'.

+static int 
+pci_create_smbiosname_file(struct pci_dev *pdev)
+{
+	if (smbios_attr_label.test && smbios_attr_label.test(&pdev->dev, NULL, NULL)) {
+		if (sysfs_create_file(&pdev->dev.kobj, &smbios_attr_label.attr))
+			return -1;
+		if (sysfs_create_file(&pdev->dev.kobj, &smbios_attr_instance.attr))
+			return -1;
+		return 0;
+	}
+	return -1;	
+}


+int pci_create_firmware_label_files(struct pci_dev *pdev)
+{
+	if (!pci_create_smbiosname_file(pdev))

> 
> Please always run your patches through scripts/checkpatch.pl and fix up
> the issues it finds before sending it out and having everyone else point
> them out to you :)
> 
> Also, a new thread is nice at times for new versions of patches...

Thanks for the feedback. Sorry for missing this.I would address all the issues 
and post the patch in a new thread.

With regards,
Narendra K

WARNING: multiple messages have this Message-ID (diff)
From: Narendra K <Narendra_K@dell.com>
To: greg@kroah.com
Cc: netdev@vger.kernel.org, linux-hotplug@vger.kernel.org,
	linux-pci@vger.kernel.org, matt_domsch@dell.com,
	jordan_hargrave@dell.com, charles_rose@dell.com,
	vijay_nijhawan@dell.com
Subject: Re: [PATCH 1/2] Export firmware assigned labels of network devices to sysfs
Date: Wed, 7 Jul 2010 12:48:26 -0500	[thread overview]
Message-ID: <20100707174826.GA1046@auslistsprd01.us.dell.com> (raw)
In-Reply-To: <EDA0A4495861324DA2618B4C45DCB3EE612B27@blrx3m08.blr.amer.dell.com>

> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com] 
> Sent: Wednesday, July 07, 2010 4:52 AM
> To: K, Narendra
> Cc: netdev@vger.kernel.org; linux-hotplug@vger.kernel.org;
> linux-pci@vger.kernel.org; Domsch, Matt; Hargrave, Jordan; Rose,
> Charles; Nijhawan, Vijay
> Subject: Re: [PATCH 1/2] Export firmware assigned labels of network
> devices to sysfs
> 
> On Tue, Jul 06, 2010 at 01:52:18PM -0500, Narendra K wrote:
> > 
> > 'device_create_file' takes 'struct device_attribute *' as a param
> which 
> > we have not used here because  'struct device_attribute' does not have
> .test
> > member which we needed in this patch.
> 
> Why do you need it?  What is calling that function?  What am I missing
> here?

The function 'pci_create_smbiosname_file' below is calling the .test method.
For every pdev the function checks if it has a SMBIOS string associated
with it or not. If there is no string (and instance) associated, then the
attributes 'label' and 'instance' are not created for that pdev.
To check for the existance of the string, the .test method is needed and
it is not available in 'struct device_attribute'. It provides 
.show and .store. We need a .show and .test. So we defined 

+struct smbios_attribute smbios_attr_label = {
+	.attr = {.name = "label", .mode = 0444, .owner = THIS_MODULE},
+	.show = smbiosname_show,
+	.test = smbios_instance_string_exist,
+};

'smbios_instance_string_exist' checks if the pdev has a 'string' and 'instance'.

+static int 
+pci_create_smbiosname_file(struct pci_dev *pdev)
+{
+	if (smbios_attr_label.test && smbios_attr_label.test(&pdev->dev, NULL, NULL)) {
+		if (sysfs_create_file(&pdev->dev.kobj, &smbios_attr_label.attr))
+			return -1;
+		if (sysfs_create_file(&pdev->dev.kobj, &smbios_attr_instance.attr))
+			return -1;
+		return 0;
+	}
+	return -1;	
+}


+int pci_create_firmware_label_files(struct pci_dev *pdev)
+{
+	if (!pci_create_smbiosname_file(pdev))

> 
> Please always run your patches through scripts/checkpatch.pl and fix up
> the issues it finds before sending it out and having everyone else point
> them out to you :)
> 
> Also, a new thread is nice at times for new versions of patches...

Thanks for the feedback. Sorry for missing this.I would address all the issues 
and post the patch in a new thread.

With regards,
Narendra K

       reply	other threads:[~2010-07-07 17:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <EDA0A4495861324DA2618B4C45DCB3EE612B27@blrx3m08.blr.amer.dell.com>
2010-07-07 17:48 ` Narendra K [this message]
2010-07-07 17:48   ` [PATCH 1/2] Export firmware assigned labels of network devices to sysfs Narendra K
2010-07-07 18:11   ` [PATCH 1/2] Export firmware assigned labels of network devices Greg KH
2010-07-07 18:11     ` [PATCH 1/2] Export firmware assigned labels of network devices to sysfs Greg KH
2010-07-07 18:35     ` [PATCH 1/2] Export firmware assigned labels of network devices Domsch, Matt
2010-07-07 18:35       ` [PATCH 1/2] Export firmware assigned labels of network devices to sysfs Domsch, Matt
     [not found] <EDA0A4495861324DA2618B4C45DCB3EE612B1B@blrx3m08.blr.amer.dell.com>
2010-07-06 18:52 ` Narendra K
2010-07-06 18:52   ` Narendra K
2010-07-06 23:22   ` Greg KH
     [not found] <EDA0A4495861324DA2618B4C45DCB3EE612AB6@blrx3m08.blr.amer.dell.com>
2010-06-29 16:28 ` Narendra K
2010-06-29 16:28   ` Narendra K
2010-06-30 15:42   ` Greg KH
2010-05-28 11:55 K, Narendra
2010-05-28 13:16 ` Domsch, Matt
2010-05-28 15:40 ` Greg KH
2010-05-28 18:11   ` Matt Domsch
2010-05-28 18:11     ` Matt Domsch
2010-05-28 22:27     ` Greg KH
2010-05-29  4:51       ` Domsch, Matt
2010-06-09  4:17         ` Matt Domsch
2010-06-09  4:17           ` Matt Domsch
2010-06-09 15:02           ` Greg KH
2010-05-31  7:55     ` Narendra_K
2010-05-31  7:55       ` Narendra_K
2010-05-31 14:07 ` Michael Ellerman
2010-05-31 18:42   ` Narendra_K
2010-05-31 18:54     ` Narendra_K
2010-06-02 23:54     ` Michael Ellerman

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=20100707174826.GA1046@auslistsprd01.us.dell.com \
    --to=narendra_k@dell.com \
    --cc=charles_rose@dell.com \
    --cc=greg@kroah.com \
    --cc=jordan_hargrave@dell.com \
    --cc=linux-hotplug@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=matt_domsch@dell.com \
    --cc=netdev@vger.kernel.org \
    --cc=vijay_nijhawan@dell.com \
    /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.