Message ID | 20230221023634.87925-1-yang.lee@linux.alibaba.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1634618wrn; Mon, 20 Feb 2023 18:41:30 -0800 (PST) X-Google-Smtp-Source: AK7set+HwjWEK8cLN4TOaI/Q22W+3rhYyZYlzUZ6EZQu/jkz6lEZ+p/SOA6Gp3xY4ve3fbxMo2GG X-Received: by 2002:a17:906:9f14:b0:8b1:3a8d:6fc5 with SMTP id fy20-20020a1709069f1400b008b13a8d6fc5mr13168983ejc.25.1676947290698; Mon, 20 Feb 2023 18:41:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676947290; cv=none; d=google.com; s=arc-20160816; b=IbZFc9rKM7rT2fgayqcLb0qy1VvQPr/7csaCUGmPrYdYC5S3MBpOqFa2R8NCoL9K6o bJcYv/qTN2XATcsnUYS4OQuyQq9acf4QrWzn5jZBpXXNKiz0RFSbr+jhkFKScfMpa21q UEj28ZJ+Yqu+5BIncs3ZBGZZvz4ECuKUkhZqD3kG55iAssxYSm5RlRDuRQJuIrNOZkQQ GFUOgm6rnKilIIE+C6Z8NgToWDch/jnSgPWCF5y2LQauQTHjxZ2WX+3Qm/RvRCbPpFk/ GCRj4oToZmQQevWvzBTFnqLiNlbjx2gxvAkFxvv6qkcpHITPBgmGcXDxVcLN7GScwzyF /lwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=rePXihfTYrc5+OgLeRheu8g36036/qXuzJ8NX1As0Nk=; b=zn1ieNS7hiiQX7CVygBYjXaAYEzV3oGQeiL0Gs7i1twyPG0g/jItxkpfb/MHRsW9k0 m10vu4zI19FhOk7hwnLvzd4Dq35W9KnQQp7TInJ/NMWzaAG+em+v7uBOs5ocJpyCEqt+ qZrLoayj3nHuVS9yBL6c7dEk/hbLTS2nqdZik26Bkzp/QxkZ5VC0Yu0IMeHs9BBkhOEq MYqNForNXiLCYa5ScJgQVhcghDpcNYGF/tWkL8vKF6lex7SKYY96tLyLjHclQh1Yu2+y 27zrXWg2+H5E5Mn3T6DRjrpq1BGp6dwzIvLTb0dQEJK+gGXtRdspATsw0qtkUCDWSpdL HxMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020aa7c64b000000b004ad03d1fd28si7067794edr.149.2023.02.20.18.41.07; Mon, 20 Feb 2023 18:41:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232989AbjBUCht (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Mon, 20 Feb 2023 21:37:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232934AbjBUChs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Feb 2023 21:37:48 -0500 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5BB823664; Mon, 20 Feb 2023 18:37:04 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R531e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=yang.lee@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0Vc9zAOj_1676946995; Received: from localhost(mailfrom:yang.lee@linux.alibaba.com fp:SMTPD_---0Vc9zAOj_1676946995) by smtp.aliyun-inc.com; Tue, 21 Feb 2023 10:36:35 +0800 From: Yang Li <yang.lee@linux.alibaba.com> To: damien.lemoal@opensource.wdc.com Cc: s.shtylyov@omp.ru, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Li <yang.lee@linux.alibaba.com> Subject: [PATCH -next] ata: pata_macio: Use of_property_present() helper Date: Tue, 21 Feb 2023 10:36:34 +0800 Message-Id: <20230221023634.87925-1-yang.lee@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758406682243793855?= X-GMAIL-MSGID: =?utf-8?q?1758406682243793855?= |
Series |
[-next] ata: pata_macio: Use of_property_present() helper
|
|
Commit Message
Yang Li
Feb. 21, 2023, 2:36 a.m. UTC
Use of_property_present() instead of of_get_property/of_find_property()
in places where we just need to test presence of a property.
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
drivers/ata/pata_macio.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
Comments
Hi Yang, Thank you for the patch! Yet something to improve: [auto build test ERROR on next-20230220] url: https://github.com/intel-lab-lkp/linux/commits/Yang-Li/ata-pata_macio-Use-of_property_present-helper/20230221-103834 patch link: https://lore.kernel.org/r/20230221023634.87925-1-yang.lee%40linux.alibaba.com patch subject: [PATCH -next] ata: pata_macio: Use of_property_present() helper config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20230221/202302211458.tgO9izcv-lkp@intel.com/config) compiler: powerpc-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/257ef88e819f378a5925cd9a44857f4591d860e9 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Yang-Li/ata-pata_macio-Use-of_property_present-helper/20230221-103834 git checkout 257ef88e819f378a5925cd9a44857f4591d860e9 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202302211458.tgO9izcv-lkp@intel.com/ All errors (new ones prefixed by >>): drivers/ata/pata_macio.c: In function 'pata_macio_cable_detect': >> drivers/ata/pata_macio.c:482:37: error: incompatible types when initializing type 'const char *' using type 'bool' {aka '_Bool'} 482 | const char *cable = of_property_present(priv->node, "cable-type"); | ^~~~~~~~~~~~~~~~~~~ drivers/ata/pata_macio.c:484:37: error: incompatible types when initializing type 'const char *' using type 'bool' {aka '_Bool'} 484 | const char *model = of_property_present(root, "model"); | ^~~~~~~~~~~~~~~~~~~ drivers/ata/pata_macio.c: In function 'pata_macio_invariants': >> drivers/ata/pata_macio.c:975:16: error: incompatible types when assigning to type 'const int *' from type 'bool' {aka '_Bool'} 975 | bidp = of_property_present(priv->node, "AAPL,bus-id"); | ^~~~~~~~~~~~~~~~~~~ vim +482 drivers/ata/pata_macio.c 472 473 static int pata_macio_cable_detect(struct ata_port *ap) 474 { 475 struct pata_macio_priv *priv = ap->private_data; 476 477 /* Get cable type from device-tree */ 478 if (priv->kind == controller_kl_ata4 || 479 priv->kind == controller_un_ata6 || 480 priv->kind == controller_k2_ata6 || 481 priv->kind == controller_sh_ata6) { > 482 const char *cable = of_property_present(priv->node, "cable-type"); 483 struct device_node *root = of_find_node_by_path("/"); 484 const char *model = of_property_present(root, "model"); 485 486 of_node_put(root); 487 488 if (cable && !strncmp(cable, "80-", 3)) { 489 /* Some drives fail to detect 80c cable in PowerBook 490 * These machine use proprietary short IDE cable 491 * anyway 492 */ 493 if (!strncmp(model, "PowerBook", 9)) 494 return ATA_CBL_PATA40_SHORT; 495 else 496 return ATA_CBL_PATA80; 497 } 498 } 499 500 /* G5's seem to have incorrect cable type in device-tree. 501 * Let's assume they always have a 80 conductor cable, this seem to 502 * be always the case unless the user mucked around 503 */ 504 if (of_device_is_compatible(priv->node, "K2-UATA") || 505 of_device_is_compatible(priv->node, "shasta-ata")) 506 return ATA_CBL_PATA80; 507 508 /* Anything else is 40 connectors */ 509 return ATA_CBL_PATA40; 510 } 511
Hello! On 2/21/23 5:36 AM, Yang Li wrote: > Use of_property_present() instead of of_get_property/of_find_property() I'm not seeing of_property_present() anywhere (we have of_prperty_read_bool() though)... what repo was this patch done against? > in places where we just need to test presence of a property. > > Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> > --- > drivers/ata/pata_macio.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c > index 9ccaac9e2bc3..f698d77e87e1 100644 > --- a/drivers/ata/pata_macio.c > +++ b/drivers/ata/pata_macio.c > @@ -479,10 +479,9 @@ static int pata_macio_cable_detect(struct ata_port *ap) > priv->kind == controller_un_ata6 || > priv->kind == controller_k2_ata6 || > priv->kind == controller_sh_ata6) { > - const char* cable = of_get_property(priv->node, "cable-type", > - NULL); > + const char *cable = of_property_present(priv->node, "cable-type"); > struct device_node *root = of_find_node_by_path("/"); > - const char *model = of_get_property(root, "model", NULL); > + const char *model = of_property_present(root, "model"); We use the values of these properties... [...] > @@ -973,7 +972,7 @@ static void pata_macio_invariants(struct pata_macio_priv *priv) > /* XXX FIXME --- setup priv->mediabay here */ > > /* Get Apple bus ID (for clock and ASIC control) */ > - bidp = of_get_property(priv->node, "AAPL,bus-id", NULL); > + bidp = of_property_present(priv->node, "AAPL,bus-id"); And this one too... [...] MBR, Sergey
diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c index 9ccaac9e2bc3..f698d77e87e1 100644 --- a/drivers/ata/pata_macio.c +++ b/drivers/ata/pata_macio.c @@ -479,10 +479,9 @@ static int pata_macio_cable_detect(struct ata_port *ap) priv->kind == controller_un_ata6 || priv->kind == controller_k2_ata6 || priv->kind == controller_sh_ata6) { - const char* cable = of_get_property(priv->node, "cable-type", - NULL); + const char *cable = of_property_present(priv->node, "cable-type"); struct device_node *root = of_find_node_by_path("/"); - const char *model = of_get_property(root, "model", NULL); + const char *model = of_property_present(root, "model"); of_node_put(root); @@ -973,7 +972,7 @@ static void pata_macio_invariants(struct pata_macio_priv *priv) /* XXX FIXME --- setup priv->mediabay here */ /* Get Apple bus ID (for clock and ASIC control) */ - bidp = of_get_property(priv->node, "AAPL,bus-id", NULL); + bidp = of_property_present(priv->node, "AAPL,bus-id"); priv->aapl_bus_id = bidp ? *bidp : 0; /* Fixup missing Apple bus ID in case of media-bay */