From patchwork Tue Jan 24 12:08:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 92339 Delivered-To: patch@linaro.org Received: by 10.182.3.34 with SMTP id 2csp1666107obz; Tue, 24 Jan 2017 04:12:37 -0800 (PST) X-Received: by 10.99.38.2 with SMTP id m2mr5192895pgm.169.1485259957745; Tue, 24 Jan 2017 04:12:37 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g21si13124102pgj.268.2017.01.24.04.12.36; Tue, 24 Jan 2017 04:12:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750999AbdAXMMf (ORCPT + 25 others); Tue, 24 Jan 2017 07:12:35 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:54582 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750847AbdAXMMe (ORCPT ); Tue, 24 Jan 2017 07:12:34 -0500 Received: from 172.24.1.36 (EHLO szxeml428-hub.china.huawei.com) ([172.24.1.36]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id COL11566; Tue, 24 Jan 2017 20:12:00 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by szxeml428-hub.china.huawei.com (10.82.67.183) with Microsoft SMTP Server id 14.3.235.1; Tue, 24 Jan 2017 20:11:54 +0800 From: Kefeng Wang To: Tejun Heo , CC: , Kefeng Wang , Bartlomiej Zolnierkiewicz , Hans de Goede Subject: [PATCH] ata: pata_of_platform: using of_property_read_u32() helper Date: Tue, 24 Jan 2017 20:08:29 +0800 Message-ID: <1485259709-16487-1-git-send-email-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using better of_property_read_u32() than generic of_get_property(). Cc: Bartlomiej Zolnierkiewicz Cc: Hans de Goede Cc: Tejun Heo Signed-off-by: Kefeng Wang --- drivers/ata/pata_of_platform.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -- 1.7.12.4 diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c index b6b7af8..201a32d 100644 --- a/drivers/ata/pata_of_platform.c +++ b/drivers/ata/pata_of_platform.c @@ -32,7 +32,6 @@ static int pata_of_platform_probe(struct platform_device *ofdev) unsigned int reg_shift = 0; int pio_mode = 0; int pio_mask; - const u32 *prop; ret = of_address_to_resource(dn, 0, &io_res); 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); - prop = of_get_property(dn, "reg-shift", NULL); - if (prop) - reg_shift = be32_to_cpup(prop); + of_property_read_u32(dn, "reg-shift", ®_shift); - prop = of_get_property(dn, "pio-mode", NULL); - if (prop) { - pio_mode = be32_to_cpup(prop); + if (!of_property_read_u32(dn, "pio-mode", &pio_mode)) { if (pio_mode > 6) { dev_err(&ofdev->dev, "invalid pio-mode\n"); return -EINVAL;