linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-pci@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>
Subject: [PATCH 1/2] PCI: Add pci_dev_type
Date: Tue,  2 Oct 2012 22:07:52 -0700	[thread overview]
Message-ID: <1349240873-1031-1-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <20121003031018.GB13391@kroah.com>

need to use it for visiable attribute control in syfsfs for pci_dev.

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

---
 drivers/pci/pci-sysfs.c |   24 ++++++++++++++++++++++++
 drivers/pci/pci.h       |    1 +
 drivers/pci/probe.c     |    1 +
 3 files changed, 26 insertions(+)

Index: linux-2.6/drivers/pci/pci-sysfs.c
===================================================================
--- linux-2.6.orig/drivers/pci/pci-sysfs.c
+++ linux-2.6/drivers/pci/pci-sysfs.c
@@ -1411,3 +1411,27 @@ static int __init pci_sysfs_init(void)
 }
 
 late_initcall(pci_sysfs_init);
+
+static struct attribute *pci_dev_dev_attrs[] = {
+	NULL,
+};
+
+static umode_t pci_dev_attrs_are_visible(struct kobject *kobj,
+						struct attribute *a, int n)
+{
+	return a->mode;
+}
+
+static struct attribute_group pci_dev_attr_group = {
+	.attrs = pci_dev_dev_attrs,
+	.is_visible = pci_dev_attrs_are_visible,
+};
+
+static const struct attribute_group *pci_dev_attr_groups[] = {
+	&pci_dev_attr_group,
+	NULL,
+};
+
+struct device_type pci_dev_type = {
+	.groups = pci_dev_attr_groups,
+};
Index: linux-2.6/drivers/pci/pci.h
===================================================================
--- linux-2.6.orig/drivers/pci/pci.h
+++ linux-2.6/drivers/pci/pci.h
@@ -157,6 +157,7 @@ static inline int pci_no_d1d2(struct pci
 }
 extern struct device_attribute pci_dev_attrs[];
 extern struct device_attribute pcibus_dev_attrs[];
+extern struct device_type pci_dev_type;
 #ifdef CONFIG_HOTPLUG
 extern struct bus_attribute pci_bus_attrs[];
 #else
Index: linux-2.6/drivers/pci/probe.c
===================================================================
--- linux-2.6.orig/drivers/pci/probe.c
+++ linux-2.6/drivers/pci/probe.c
@@ -975,6 +975,7 @@ int pci_setup_device(struct pci_dev *dev
 	dev->sysdata = dev->bus->sysdata;
 	dev->dev.parent = dev->bus->bridge;
 	dev->dev.bus = &pci_bus_type;
+	dev->dev.type = &pci_dev_type;
 	dev->hdr_type = hdr_type & 0x7f;
 	dev->multifunction = !!(hdr_type & 0x80);
 	dev->error_state = pci_channel_io_normal;

  parent reply	other threads:[~2012-10-03  5:07 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-01 23:27 [RFC] PCI: enable and disable sriov support via sysfs at per device level Donald Dutile
2012-10-02  7:32 ` Yuval Mintz
2012-10-02 17:38   ` Don Dutile
2012-10-02 20:01 ` Yinghai Lu
2012-10-02 20:23   ` Don Dutile
2012-10-02 20:33     ` Yinghai Lu
2012-10-02 20:39     ` Greg Kroah-Hartman
2012-10-02 21:06       ` Don Dutile
2012-10-03  3:10         ` Greg Kroah-Hartman
2012-10-03  4:58           ` Yinghai Lu
2012-10-03  5:07           ` Yinghai Lu [this message]
2012-10-03  5:07             ` [PATCH 2/2] PCI, sys: Use is_visable() with boot_vga attribute for pci_dev Yinghai Lu
2012-10-03 13:18           ` [RFC] PCI: enable and disable sriov support via sysfs at per device level Don Dutile
2012-10-03 17:51             ` [PATCH 0/5] PCI: per pci device sysfs set_max_vfs support Yinghai Lu
2012-10-03 17:51               ` [PATCH 1/5] PCI: Add pci_dev_type Yinghai Lu
2012-10-04 14:10                 ` Konrad Rzeszutek Wilk
2012-10-03 17:51               ` [PATCH 2/5] PCI, sys: Use is_visable() with boot_vga attribute for pci_dev Yinghai Lu
2012-10-03 19:28                 ` Greg Kroah-Hartman
2012-10-03 17:51               ` [PATCH 3/5] PCI: add set_max_vfs in pci_driver ops Yinghai Lu
2012-10-03 18:55                 ` Don Dutile
2012-10-03 20:41                   ` Yinghai Lu
2012-10-03 21:02                     ` Don Dutile
2012-10-03 17:51               ` [PATCH 4/5] PCI: Add max_vfs in sysfs per pci device where supports Yinghai Lu
2012-10-04 14:15                 ` Konrad Rzeszutek Wilk
2012-10-04 15:13                   ` Yinghai Lu
2012-10-03 17:51               ` [PATCH 5/5] ixgbe: add driver set_max_vfs support Yinghai Lu
2012-10-03 17:57                 ` Yinghai Lu
2012-10-03 18:45                 ` Dan Carpenter
2012-10-03 18:47                 ` Alexander Duyck
2012-10-03 19:02                   ` Don Dutile
2012-10-03 19:16                     ` Rose, Gregory V
2012-10-03 20:37                   ` Yinghai Lu
2012-10-03 17:55             ` [RFC] PCI: enable and disable sriov support via sysfs at per device level Yinghai Lu
2012-10-03 18:16               ` Rose, Gregory V
2012-10-03 18:28                 ` Yinghai Lu
2012-10-03 13:00         ` Konrad Rzeszutek Wilk

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=1349240873-1031-1-git-send-email-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-pci@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 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).