diff mbox

[2/4] PCI,sys: Use is_visible() with boot_vga attribute for pci_dev

Message ID 1351718353-6124-3-git-send-email-ddutile@redhat.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Donald Dutile Oct. 31, 2012, 9:19 p.m. UTC
From: Don Dutile <ddutile@dddsys1.bos.redhat.com>

Should make pci_creae_sysfs_dev_files simpler.
Also fix possible memleak in remove path.

Authored-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Donald Dutile <ddutile@redhat.com>
---
 drivers/pci/pci-sysfs.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

Comments

Yinghai Lu Oct. 31, 2012, 9:53 p.m. UTC | #1
On Wed, Oct 31, 2012 at 2:19 PM, Donald Dutile <ddutile@redhat.com> wrote:
> From: Don Dutile <ddutile@dddsys1.bos.redhat.com>

should be
From:  Yinghai Lu <yinghai@kernel.org>

>
> Should make pci_creae_sysfs_dev_files simpler.
> Also fix possible memleak in remove path.
>
> Authored-by: Yinghai Lu <yinghai@kernel.org>

should be:
Signed-off-by: Yinghai Lu <yinghai@kernel.org>

> Signed-off-by: Donald Dutile <ddutile@redhat.com>

patch 1 and 2 got acked-by from Greg KH

https://patchwork.kernel.org/patch/1542941/
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Donald Dutile Oct. 31, 2012, 10:08 p.m. UTC | #2
On 10/31/2012 05:53 PM, Yinghai Lu wrote:
> On Wed, Oct 31, 2012 at 2:19 PM, Donald Dutile<ddutile@redhat.com>  wrote:
>> From: Don Dutile<ddutile@dddsys1.bos.redhat.com>
>
> should be
> From:  Yinghai Lu<yinghai@kernel.org>
>
sorry. Tried to credit you for 1st two patches.

>>
>> Should make pci_creae_sysfs_dev_files simpler.
>> Also fix possible memleak in remove path.
>>
>> Authored-by: Yinghai Lu<yinghai@kernel.org>
>
> should be:
> Signed-off-by: Yinghai Lu<yinghai@kernel.org>
>
I didn't want to sign off for you b/c I reworded
the log.  I was trying to credit you for the patch
by stating you Authored it.  My apologies if that was
incorrect.

>> Signed-off-by: Donald Dutile<ddutile@redhat.com>
>
> patch 1 and 2 got acked-by from Greg KH
>
> https://patchwork.kernel.org/patch/1542941/
Yes, but didn't see it in Linus' git tree.
Should I have used one of Bjorn's tree/branch with
this patch in it as master of these patches ?

> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yinghai Lu Oct. 31, 2012, 10:20 p.m. UTC | #3
On Wed, Oct 31, 2012 at 3:08 PM, Don Dutile <ddutile@redhat.com> wrote:
> On 10/31/2012 05:53 PM, Yinghai Lu wrote:
>>
>> On Wed, Oct 31, 2012 at 2:19 PM, Donald Dutile<ddutile@redhat.com>  wrote:
>>>
>>> From: Don Dutile<ddutile@dddsys1.bos.redhat.com>
>>
>>
>> should be
>> From:  Yinghai Lu<yinghai@kernel.org>
>>
> sorry. Tried to credit you for 1st two patches.
>
>
>>>
>>> Should make pci_creae_sysfs_dev_files simpler.
>>> Also fix possible memleak in remove path.
>>>
>>> Authored-by: Yinghai Lu<yinghai@kernel.org>
>>
>>
>> should be:
>> Signed-off-by: Yinghai Lu<yinghai@kernel.org>
>>
> I didn't want to sign off for you b/c I reworded
> the log.  I was trying to credit you for the patch
> by stating you Authored it.  My apologies if that was
> incorrect.
>
>

if you change log, you still can keep my old Signed-off and add
[ changelog updated.... Donald]
>>> Signed-off-by: Donald Dutile<ddutile@redhat.com>

>>
>>
>> patch 1 and 2 got acked-by from Greg KH
>>
>> https://patchwork.kernel.org/patch/1542941/
>
> Yes, but didn't see it in Linus' git tree.
> Should I have used one of Bjorn's tree/branch with
> this patch in it as master of these patches ?

if bjorn could give Acked-by, those pci change patches go together
with ixgbe changes via Dave's Net-next tree.

or bjorn add one branch in pci next tree to have the first 4 patches,
and let Dave to pull it and use as base for ixgbe change.

or just first 4 patches go into 3.7 directly...
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 3d160aa..fbbb97f 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1303,29 +1303,20 @@  int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
 		pdev->rom_attr = attr;
 	}
 
-	if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA) {
-		retval = device_create_file(&pdev->dev, &vga_attr);
-		if (retval)
-			goto err_rom_file;
-	}
-
 	/* add platform-specific attributes */
 	retval = pcibios_add_platform_entries(pdev);
 	if (retval)
-		goto err_vga_file;
+		goto err_rom_file;
 
 	/* add sysfs entries for various capabilities */
 	retval = pci_create_capabilities_sysfs(pdev);
 	if (retval)
-		goto err_vga_file;
+		goto err_rom_file;
 
 	pci_create_firmware_label_files(pdev);
 
 	return 0;
 
-err_vga_file:
-	if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA)
-		device_remove_file(&pdev->dev, &vga_attr);
 err_rom_file:
 	if (rom_size) {
 		sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr);
@@ -1413,12 +1404,20 @@  static int __init pci_sysfs_init(void)
 late_initcall(pci_sysfs_init);
 
 static struct attribute *pci_dev_dev_attrs[] = {
+	&vga_attr.attr,
 	NULL,
 };
 
 static umode_t pci_dev_attrs_are_visible(struct kobject *kobj,
 						struct attribute *a, int n)
 {
+	struct device *dev = container_of(kobj, struct device, kobj);
+	struct pci_dev *pdev = to_pci_dev(dev);
+
+	if (a == &vga_attr.attr)
+		if ((pdev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
+			return 0;
+
 	return a->mode;
 }