mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
drivers/pci/hotplug: Use of_property_read_u32() in powernv driver
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> [mpe: Fold in the change to the "ibm,slot-surprise-pluggable" case] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
735840b44b
commit
39f0d6fbdc
@ -547,9 +547,10 @@ static struct pnv_php_slot *pnv_php_alloc_slot(struct device_node *dn)
|
|||||||
struct pci_bus *bus;
|
struct pci_bus *bus;
|
||||||
const char *label;
|
const char *label;
|
||||||
uint64_t id;
|
uint64_t id;
|
||||||
|
int ret;
|
||||||
|
|
||||||
label = of_get_property(dn, "ibm,slot-label", NULL);
|
ret = of_property_read_string(dn, "ibm,slot-label", &label);
|
||||||
if (!label)
|
if (ret)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (pnv_pci_get_slot_id(dn, &id))
|
if (pnv_pci_get_slot_id(dn, &id))
|
||||||
@ -821,16 +822,16 @@ static void pnv_php_enable_irq(struct pnv_php_slot *php_slot)
|
|||||||
static int pnv_php_register_one(struct device_node *dn)
|
static int pnv_php_register_one(struct device_node *dn)
|
||||||
{
|
{
|
||||||
struct pnv_php_slot *php_slot;
|
struct pnv_php_slot *php_slot;
|
||||||
const __be32 *prop32;
|
u32 prop32;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* Check if it's hotpluggable slot */
|
/* Check if it's hotpluggable slot */
|
||||||
prop32 = of_get_property(dn, "ibm,slot-pluggable", NULL);
|
ret = of_property_read_u32(dn, "ibm,slot-pluggable", &prop32);
|
||||||
if (!prop32 || !of_read_number(prop32, 1))
|
if (ret || !prop32)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
||||||
prop32 = of_get_property(dn, "ibm,reset-by-firmware", NULL);
|
ret = of_property_read_u32(dn, "ibm,reset-by-firmware", &prop32);
|
||||||
if (!prop32 || !of_read_number(prop32, 1))
|
if (ret || !prop32)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
||||||
php_slot = pnv_php_alloc_slot(dn);
|
php_slot = pnv_php_alloc_slot(dn);
|
||||||
@ -846,8 +847,8 @@ static int pnv_php_register_one(struct device_node *dn)
|
|||||||
goto unregister_slot;
|
goto unregister_slot;
|
||||||
|
|
||||||
/* Enable interrupt if the slot supports surprise hotplug */
|
/* Enable interrupt if the slot supports surprise hotplug */
|
||||||
prop32 = of_get_property(dn, "ibm,slot-surprise-pluggable", NULL);
|
ret = of_property_read_u32(dn, "ibm,slot-surprise-pluggable", &prop32);
|
||||||
if (prop32 && of_read_number(prop32, 1))
|
if (!ret && prop32)
|
||||||
pnv_php_enable_irq(php_slot);
|
pnv_php_enable_irq(php_slot);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user