diff mbox series

[v4,06/11] libata: Add ata_scsi_durable_name

Message ID 20200724171706.1550403-7-tasleson@redhat.com
State Not Applicable
Delegated to: David Miller
Headers show
Series Add persistent durable identifier to storage log messages | expand

Commit Message

Tony Asleson July 24, 2020, 5:17 p.m. UTC
Function used to create the durable name for ata scsi.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
---
 drivers/ata/libata-scsi.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

kernel test robot July 25, 2020, 12:48 a.m. UTC | #1
Hi Tony,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162]

url:    https://github.com/0day-ci/linux/commits/Tony-Asleson/Add-persistent-durable-identifier-to-storage-log-messages/20200725-011936
base:    3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce (this is a W=1 build):
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/ata/libata-scsi.c:1094:5: warning: no previous prototype for 'ata_scsi_durable_name' [-Wmissing-prototypes]
    1094 | int ata_scsi_durable_name(const struct device *dev, char *buf, size_t len)
         |     ^~~~~~~~~~~~~~~~~~~~~

vim +/ata_scsi_durable_name +1094 drivers/ata/libata-scsi.c

  1093	
> 1094	int ata_scsi_durable_name(const struct device *dev, char *buf, size_t len)
  1095	{
  1096		struct ata_device *ata_dev = container_of(dev, struct ata_device, tdev);
  1097	
  1098		return scsi_durable_name(ata_dev->sdev, buf, len);
  1099	}
  1100	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot July 25, 2020, 1:07 a.m. UTC | #2
Hi Tony,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162]

url:    https://github.com/0day-ci/linux/commits/Tony-Asleson/Add-persistent-durable-identifier-to-storage-log-messages/20200725-011936
base:    3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162
config: x86_64-randconfig-s022-20200724 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-93-g4c6cbe55-dirty
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> drivers/ata/libata-scsi.c:1094:5: sparse: sparse: symbol 'ata_scsi_durable_name' was not declared. Should it be static?
   drivers/ata/libata-scsi.c:1803:13: sparse: sparse: context imbalance in 'ata_scsi_rbuf_get' - wrong count at exit
   drivers/ata/libata-scsi.c:1833:31: sparse: sparse: context imbalance in 'ata_scsi_rbuf_fill' - unexpected unlock

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot July 25, 2020, 1:18 a.m. UTC | #3
Hi Tony,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162]

url:    https://github.com/0day-ci/linux/commits/Tony-Asleson/Add-persistent-durable-identifier-to-storage-log-messages/20200725-011936
base:    3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162
config: x86_64-randconfig-a005-20200724 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 1d09ecf36175f7910ffedd6d497c07b5c74c22fb)
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
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/ata/libata-scsi.c:1094:5: warning: no previous prototype for function 'ata_scsi_durable_name' [-Wmissing-prototypes]
   int ata_scsi_durable_name(const struct device *dev, char *buf, size_t len)
       ^
   drivers/ata/libata-scsi.c:1094:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int ata_scsi_durable_name(const struct device *dev, char *buf, size_t len)
   ^
   static 
   1 warning generated.

vim +/ata_scsi_durable_name +1094 drivers/ata/libata-scsi.c

  1093	
> 1094	int ata_scsi_durable_name(const struct device *dev, char *buf, size_t len)
  1095	{
  1096		struct ata_device *ata_dev = container_of(dev, struct ata_device, tdev);
  1097	
  1098		return scsi_durable_name(ata_dev->sdev, buf, len);
  1099	}
  1100	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Andy Shevchenko July 25, 2020, 10:26 a.m. UTC | #4
On Fri, Jul 24, 2020 at 8:19 PM Tony Asleson <tasleson@redhat.com> wrote:
>
> Function used to create the durable name for ata scsi.

https://chris.beams.io/posts/git-commit/

> Signed-off-by: Tony Asleson <tasleson@redhat.com>

...

> +}
> +
> +

One is enough, really!

>  /**

...

> -       if (dev)
> +       if (dev) {
>                 rc = ata_scsi_dev_config(sdev, dev);
> +               if (!rc)
> +                       dev->tdev.durable_name = ata_scsi_durable_name;
> +       }

Can we stick to our usual pattern?

rc = ...
if (rc)
  return rc;
...

>         return rc;
>  }
diff mbox series

Patch

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 36e588d88b95..ec1f6e406ceb 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1091,6 +1091,14 @@  int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev)
 	return 0;
 }
 
+int ata_scsi_durable_name(const struct device *dev, char *buf, size_t len)
+{
+	struct ata_device *ata_dev = container_of(dev, struct ata_device, tdev);
+
+	return scsi_durable_name(ata_dev->sdev, buf, len);
+}
+
+
 /**
  *	ata_scsi_slave_config - Set SCSI device attributes
  *	@sdev: SCSI device to examine
@@ -1111,8 +1119,11 @@  int ata_scsi_slave_config(struct scsi_device *sdev)
 
 	ata_scsi_sdev_config(sdev);
 
-	if (dev)
+	if (dev) {
 		rc = ata_scsi_dev_config(sdev, dev);
+		if (!rc)
+			dev->tdev.durable_name = ata_scsi_durable_name;
+	}
 
 	return rc;
 }