From patchwork Sun Aug 27 19:55:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 806299 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=cogentembedded-com.20150623.gappssmtp.com header.i=@cogentembedded-com.20150623.gappssmtp.com header.b="ORvJhERa"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xgQdK2HFJz9s8V for ; Mon, 28 Aug 2017 05:56:21 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751300AbdH0T4U (ORCPT ); Sun, 27 Aug 2017 15:56:20 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:34164 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751294AbdH0T4T (ORCPT ); Sun, 27 Aug 2017 15:56:19 -0400 Received: by mail-lf0-f53.google.com with SMTP id d17so15181433lfe.1 for ; Sun, 27 Aug 2017 12:56:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:user-agent:date:to:cc:subject:mime-version :content-disposition; bh=hqgIbfFzBoqE3Jf00o1qxQY5jW5m2Cqnj3W5z+bjDmM=; b=ORvJhERaTs08HFujA3oXj3Fiue4yxACnGctCyOJEiT1770V7wKK1A+QGmKPG+n2kTL NjvkDazTtZlQlsYc17rX2I5fO+J//so8+w0Gz89ZaZFuMjprrl7aItHrq7pZDkkOWTNU z9HshBfAYbFm1DlDbBGexuaMm4rHOLTqNgPDFV4N9x8UNZS1VBScgdpzzA7X4SptjLwj RG2TkYYxYjEp7M9umRRF04kZsWkAwm/3rh2TROGN+s87vX0/4aAMdQlrllReMU3ArKBG GtOq8gkbx0O0732wcQxqVNagapHURKB1lM17k6fGTWbDfSNkycicdTXLEVqBvqNiGRlV YIsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:user-agent:date:to:cc:subject :mime-version:content-disposition; bh=hqgIbfFzBoqE3Jf00o1qxQY5jW5m2Cqnj3W5z+bjDmM=; b=KUwEtK1Be7cthfzxZCsnHdQdcne0c2EzYZwhAt39pjTTRpyyNRJwwQ5WsOFR3yPxH2 nAPfcAuof3d6UQcUVA/SwONwDgXTjg7JTPfCSiYEY2rQwMWTEB9ZUP3aHYDpdny0aPlc 1QpIpenuoWd9NXSYlcA6Ruf8dWtN1SHNkSD5Cnd0sL+8IWAyDmrxHf0dAOWiBr7TOAiN Tgx3a+uTMzayQwEFK0WWQtDdytx9H/8WnRFJJiqaDmB+BEXbhd0EuiT83NpRHrfnDN7N ADFuyZEcgeyxqm4zxvgy4CGWCii12amihdz65hBzywCW6Nz4+mvkmcy6jccQ0oDl7SnO Zl1g== X-Gm-Message-State: AHYfb5jwSbMhnHuJYt5NrNRk8ezwC9x11DH2/RyIgofpj//NcgY7l4y4 bqhSqNR/J11FzeOo X-Received: by 10.46.69.131 with SMTP id s125mr1959653lja.131.1503863778027; Sun, 27 Aug 2017 12:56:18 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.80.216]) by smtp.gmail.com with ESMTPSA id d192sm2007659lfe.89.2017.08.27.12.56.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 27 Aug 2017 12:56:16 -0700 (PDT) From: Sergei Shtylyov X-Google-Original-From: "Sergei Shtylyov" Received: by wasted.cogentembedded.com (sSMTP sendmail emulation); Sun, 27 Aug 2017 22:56:13 +0300 Message-Id: <20170827195613.904715064@cogentembedded.com> User-Agent: quilt/0.64 Date: Sun, 27 Aug 2017 22:55:09 +0300 To: Bartlomiej Zolnierkiewicz , Tejun Heo , linux-ide@vger.kernel.org ("open list:LIBATA PATA DRIVERS") Cc: linux-mips@linux-mips.org, Sergei Shtylyov Subject: [PATCH] pata_octeon_cf: use of_property_read_{bool|u32}() MIME-Version: 1.0 Content-Disposition: inline; filename=pata_octeon_cf-use-of_property_read_-bool-u32.patch Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org The Octeon CF driver basically open-codes of_property_read_{bool|u32}() using of_{find|get}_property() calls in its probe() method. Using the modern DT APIs saves 2 LoCs and 16 bytes of object code (MIPS gcc 3.4.3). Signed-off-by: Sergei Shtylyov Acked-by: David Daney --- drivers/ata/pata_octeon_cf.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: libata/drivers/ata/pata_octeon_cf.c =================================================================== --- libata.orig/drivers/ata/pata_octeon_cf.c +++ libata/drivers/ata/pata_octeon_cf.c @@ -840,7 +840,6 @@ static int octeon_cf_probe(struct platfo struct property *reg_prop; int n_addr, n_size, reg_len; struct device_node *node; - const void *prop; void __iomem *cs0; void __iomem *cs1 = NULL; struct ata_host *host; @@ -850,7 +849,7 @@ static int octeon_cf_probe(struct platfo void __iomem *base; struct octeon_cf_port *cf_port; int rv = -ENOMEM; - + u32 bus_width; node = pdev->dev.of_node; if (node == NULL) @@ -860,11 +859,10 @@ static int octeon_cf_probe(struct platfo if (!cf_port) return -ENOMEM; - cf_port->is_true_ide = (of_find_property(node, "cavium,true-ide", NULL) != NULL); + cf_port->is_true_ide = of_property_read_bool(node, "cavium,true-ide"); - prop = of_get_property(node, "cavium,bus-width", NULL); - if (prop) - is_16bit = (be32_to_cpup(prop) == 16); + if (of_property_read_u32(node, "cavium,bus-width", &bus_width) == 0) + is_16bit = (bus_width == 16); else is_16bit = false;