linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michal Simek <monstr@monstr.eu>,
	Paul Mackerras <paulus@samba.org>
Subject: Re: [Resend] pcibios_add_platform_entries usage
Date: Fri, 18 Apr 2014 07:02:55 +1000	[thread overview]
Message-ID: <1397768575.32730.70.camel@pasglop> (raw)
In-Reply-To: <alpine.LFD.2.11.1404171938190.1588@denkbrett>

On Thu, 2014-04-17 at 19:46 +0200, Sebastian Ott wrote:

> pci: move open fabric devspec attribute to pci common code
> 
> Move the devspec OF attribute to pci common code's set of device
> attributes since it's not architecture dependent.
> As a side effect microblaze and powerpc no longer need to use
> pcibios_add_platform_entries.
> 
> Link: https://lkml.kernel.org/r/alpine.LFD.2.11.1404141101500.1529@denkbrett
> Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

(Pending you've compile tested it on powerpc, I'm on vacation and
haven't done it :)

> ---
>  arch/microblaze/pci/pci-common.c |   20 --------------------
>  arch/powerpc/kernel/pci-common.c |   20 --------------------
>  drivers/pci/pci-sysfs.c          |   17 +++++++++++++++++
>  3 files changed, 17 insertions(+), 40 deletions(-)
> 
> --- a/arch/microblaze/pci/pci-common.c
> +++ b/arch/microblaze/pci/pci-common.c
> @@ -168,26 +168,6 @@ struct pci_controller *pci_find_hose_for
>  	return NULL;
>  }
>  
> -static ssize_t pci_show_devspec(struct device *dev,
> -		struct device_attribute *attr, char *buf)
> -{
> -	struct pci_dev *pdev;
> -	struct device_node *np;
> -
> -	pdev = to_pci_dev(dev);
> -	np = pci_device_to_OF_node(pdev);
> -	if (np == NULL || np->full_name == NULL)
> -		return 0;
> -	return sprintf(buf, "%s", np->full_name);
> -}
> -static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
> -
> -/* Add sysfs properties */
> -int pcibios_add_platform_entries(struct pci_dev *pdev)
> -{
> -	return device_create_file(&pdev->dev, &dev_attr_devspec);
> -}
> -
>  void pcibios_set_master(struct pci_dev *dev)
>  {
>  	/* No special bus mastering setup handling */
> --- a/arch/powerpc/kernel/pci-common.c
> +++ b/arch/powerpc/kernel/pci-common.c
> @@ -201,26 +201,6 @@ struct pci_controller* pci_find_hose_for
>  	return NULL;
>  }
>  
> -static ssize_t pci_show_devspec(struct device *dev,
> -		struct device_attribute *attr, char *buf)
> -{
> -	struct pci_dev *pdev;
> -	struct device_node *np;
> -
> -	pdev = to_pci_dev (dev);
> -	np = pci_device_to_OF_node(pdev);
> -	if (np == NULL || np->full_name == NULL)
> -		return 0;
> -	return sprintf(buf, "%s", np->full_name);
> -}
> -static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
> -
> -/* Add sysfs properties */
> -int pcibios_add_platform_entries(struct pci_dev *pdev)
> -{
> -	return device_create_file(&pdev->dev, &dev_attr_devspec);
> -}
> -
>  /*
>   * Reads the interrupt pin to determine if interrupt is use by card.
>   * If the interrupt is used, then gets the interrupt line from the
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -416,6 +416,20 @@ static ssize_t d3cold_allowed_show(struc
>  static DEVICE_ATTR_RW(d3cold_allowed);
>  #endif
>  
> +#ifdef CONFIG_OF
> +static ssize_t devspec_show(struct device *dev,
> +			    struct device_attribute *attr, char *buf)
> +{
> +	struct pci_dev *pdev = to_pci_dev(dev);
> +	struct device_node *np = pci_device_to_OF_node(pdev);
> +
> +	if (np == NULL || np->full_name == NULL)
> +		return 0;
> +	return sprintf(buf, "%s", np->full_name);
> +}
> +static DEVICE_ATTR_RO(devspec);
> +#endif
> +
>  #ifdef CONFIG_PCI_IOV
>  static ssize_t sriov_totalvfs_show(struct device *dev,
>  				   struct device_attribute *attr,
> @@ -521,6 +535,9 @@ static struct attribute *pci_dev_attrs[]
>  #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
>  	&dev_attr_d3cold_allowed.attr,
>  #endif
> +#ifdef CONFIG_OF
> +	&dev_attr_devspec.attr,
> +#endif
>  	NULL,
>  };
>  



  reply	other threads:[~2014-04-17 21:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28 18:41 pcibios_add_platform_entries usage Sebastian Ott
2014-04-14  9:03 ` [Resend] " Sebastian Ott
2014-04-14 17:35   ` Bjorn Helgaas
2014-04-14 18:07     ` Sebastian Ott
2014-04-17 17:46       ` Sebastian Ott
2014-04-17 21:02         ` Benjamin Herrenschmidt [this message]
2014-04-18 10:10           ` Sebastian Ott
2014-04-18 21:31             ` Benjamin Herrenschmidt
2014-04-22  8:26               ` Sebastian Ott
2014-04-23  6:48                 ` Michal Simek
2014-04-23  9:00                   ` Sebastian Ott
2014-04-29 23:30         ` Bjorn Helgaas
2014-04-30 14:40           ` Sebastian Ott

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=1397768575.32730.70.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=monstr@monstr.eu \
    --cc=paulus@samba.org \
    --cc=sebott@linux.vnet.ibm.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 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).