From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: bhelgaas@google.com, mpe@ellerman.id.au,
Gavin Shan <gwshan@linux.vnet.ibm.com>
Subject: [PATCH v4 6/7] drivers/pci/hotplug: Use of_property_read_u32() in powernv driver
Date: Thu, 29 Sep 2016 15:52:04 +1000 [thread overview]
Message-ID: <1475128325-5367-7-git-send-email-gwshan@linux.vnet.ibm.com> (raw)
In-Reply-To: <1475128325-5367-1-git-send-email-gwshan@linux.vnet.ibm.com>
This replaces of_get_property() with of_property_read_u32() or
of_property_read_string() so that we needn't consider the endian
issue, the returned value always is in CPU-endian.
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
---
drivers/pci/hotplug/pnv_php.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c
index 182f218..96ccb7f 100644
--- a/drivers/pci/hotplug/pnv_php.c
+++ b/drivers/pci/hotplug/pnv_php.c
@@ -513,9 +513,10 @@ static struct pnv_php_slot *pnv_php_alloc_slot(struct device_node *dn)
struct pci_bus *bus;
const char *label;
uint64_t id;
+ int ret;
- label = of_get_property(dn, "ibm,slot-label", NULL);
- if (!label)
+ ret = of_property_read_string(dn, "ibm,slot-label", &label);
+ if (ret)
return NULL;
if (pnv_pci_get_slot_id(dn, &id))
@@ -612,16 +613,16 @@ static int pnv_php_register_slot(struct pnv_php_slot *php_slot)
static int pnv_php_register_one(struct device_node *dn)
{
struct pnv_php_slot *php_slot;
- const __be32 *prop32;
+ u32 prop32;
int ret;
/* Check if it's hotpluggable slot */
- prop32 = of_get_property(dn, "ibm,slot-pluggable", NULL);
- if (!prop32 || !of_read_number(prop32, 1))
+ ret = of_property_read_u32(dn, "ibm,slot-pluggable", &prop32);
+ if (ret || !prop32)
return -ENXIO;
- prop32 = of_get_property(dn, "ibm,reset-by-firmware", NULL);
- if (!prop32 || !of_read_number(prop32, 1))
+ ret = of_property_read_u32(dn, "ibm,reset-by-firmware", &prop32);
+ if (ret || !prop32)
return -ENXIO;
php_slot = pnv_php_alloc_slot(dn);
--
2.1.0
next prev parent reply other threads:[~2016-09-29 5:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-29 5:51 [PATCH v4 0/7] powerpc/powernv: PCI Surprise Hotplug Support Gavin Shan
2016-09-29 5:51 ` [PATCH v4 1/7] powerpc/eeh: Allow to freeze PE in eeh_pe_set_option() Gavin Shan
2016-09-29 5:52 ` [PATCH v4 2/7] powerpc/eeh: Export confirm_error_lock Gavin Shan
2016-09-29 5:52 ` [PATCH v4 3/7] powerpc/eeh: Export eeh_pe_state_mark() Gavin Shan
2016-09-29 5:52 ` [PATCH v4 4/7] powerpc/powernv: Unfreeze PE on allocation Gavin Shan
2016-09-29 5:52 ` [PATCH v4 5/7] drivers/pci/hotplug: Remove likely() and unlikely() in powernv driver Gavin Shan
2016-09-29 5:52 ` Gavin Shan [this message]
2016-10-05 2:36 ` [v4, 6/7] drivers/pci/hotplug: Use of_property_read_u32() " Michael Ellerman
2016-09-29 5:52 ` [PATCH v4 7/7] drivers/pci/hotplug: Support surprise hotplug " Gavin Shan
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=1475128325-5367-7-git-send-email-gwshan@linux.vnet.ibm.com \
--to=gwshan@linux.vnet.ibm.com \
--cc=bhelgaas@google.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
/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).