Message ID | 20230221023634.87925-1-yang.lee@linux.alibaba.com |
---|---|
State | New |
Headers | show |
Series | [-next] ata: pata_macio: Use of_property_present() helper | expand |
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 */
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(-)