ata: pata_of_platform: using of_property_read_u32() helper
Using better of_property_read_u32() than generic of_get_property(). Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
5946fdaee4
commit
73b2951414
|
@ -32,7 +32,6 @@ static int pata_of_platform_probe(struct platform_device *ofdev)
|
||||||
unsigned int reg_shift = 0;
|
unsigned int reg_shift = 0;
|
||||||
int pio_mode = 0;
|
int pio_mode = 0;
|
||||||
int pio_mask;
|
int pio_mask;
|
||||||
const u32 *prop;
|
|
||||||
|
|
||||||
ret = of_address_to_resource(dn, 0, &io_res);
|
ret = of_address_to_resource(dn, 0, &io_res);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
|
@ -50,13 +49,9 @@ static int pata_of_platform_probe(struct platform_device *ofdev)
|
||||||
|
|
||||||
irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
|
irq_res = platform_get_resource(ofdev, IORESOURCE_IRQ, 0);
|
||||||
|
|
||||||
prop = of_get_property(dn, "reg-shift", NULL);
|
of_property_read_u32(dn, "reg-shift", ®_shift);
|
||||||
if (prop)
|
|
||||||
reg_shift = be32_to_cpup(prop);
|
|
||||||
|
|
||||||
prop = of_get_property(dn, "pio-mode", NULL);
|
if (!of_property_read_u32(dn, "pio-mode", &pio_mode)) {
|
||||||
if (prop) {
|
|
||||||
pio_mode = be32_to_cpup(prop);
|
|
||||||
if (pio_mode > 6) {
|
if (pio_mode > 6) {
|
||||||
dev_err(&ofdev->dev, "invalid pio-mode\n");
|
dev_err(&ofdev->dev, "invalid pio-mode\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Reference in New Issue