From patchwork Mon Mar 4 19:39:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 159571 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4138467jad; Mon, 4 Mar 2019 11:39:41 -0800 (PST) X-Google-Smtp-Source: APXvYqxtqly1CRXjEvBfSmN6LEWtsivKftH15Uu+pCejHuNIP+FQi91/JXCX5LEss8ZMu7cIuHYC X-Received: by 2002:a63:7503:: with SMTP id q3mr18712802pgc.98.1551728381450; Mon, 04 Mar 2019 11:39:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551728381; cv=none; d=google.com; s=arc-20160816; b=ixeUSLxvUpPGCJuwVDMO/KNPnpIZqOigSR7lxn9aylj2WyiK+kbDCclH3JR4zjZnCa hTlQmgBzvtAw80ZvS7EZUMvO5KTuIk3Q3KsXn1jcbYEhBKOak1tFAGy82DKNmLMMoAI7 gZkeGyhCrmbu0m/OSIjTuJUdo5Mw7iUaEA3gczAoOka7lGxw9ujEe33esrZUflI2GWwU RGTLkXLjh0849sviRNDnpGpVS3o1XHtYp9hCAdlUZQWr7b306hbMgHhZf5Upw0KMsKO9 IajMeeJaxukvID6duYPk1BDMLdmb1i7UXNN+riLu+qW02czCb+OJ/q1eBKdlpOFPieWI Eiaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=FeF9bEXXNtpkTRZ5ze2bFpQtsbEKTskqLiMX7ONdOes=; b=mMu3fPDtSl0WmjcyWGqPykGSjIuNQPzQjX9qrOHS0WzcXnpQAn/Y/ckaIL7tRdJyPM mNfe+dNiz9g5gZQDOmrPQFZ4tm836dMq4ChjHRepdD79mAtofAt5U1+GCCpaKy77hbt9 cVQ5qpVvOVtcTwKiLMrIKbt9UECrIDQCkyUkM8BLWqDujG0Gxc/6syCVtQiRJ+3/1oaG 5ZDB1f/7+/nY9Y53XJnENOYXn6FtIuDWwHoEjpILAHbeW91n1NmRxQzhCBGTvI6PC26J sEze889lfBexnh4WYsYB0hOZcUVVmyUOtewygPTUwN2IEYxCH+iWppsf28Y7IL8a7qvF XejQ== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si6066253plo.418.2019.03.04.11.39.41; Mon, 04 Mar 2019 11:39:41 -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 S1726318AbfCDTjj (ORCPT + 31 others); Mon, 4 Mar 2019 14:39:39 -0500 Received: from mout.kundenserver.de ([212.227.126.130]:45461 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726249AbfCDTji (ORCPT ); Mon, 4 Mar 2019 14:39:38 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1MI5YN-1gmoP211Xz-00FBn2; Mon, 04 Mar 2019 20:39:27 +0100 From: Arnd Bergmann To: James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Hannes Reinecke , Colin Ian King , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] scsi: lpfc: fix 32-bit format string warning Date: Mon, 4 Mar 2019 20:39:09 +0100 Message-Id: <20190304193917.702601-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190304193917.702601-1-arnd@arndb.de> References: <20190304193917.702601-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:+fIGMcSmqHKn1OJVorNl9fjA9KSVkCozrlL8TIyirlZAvTTYnSj cfEhuN3COW99I6N5vqKXi5KIfpO2EQA69ich3mmlE10eK35IiKrXLRH1rKhUj/lWELLbTYR QusSilWesSP3fD4Mx17r71YWl8EUoqNqffqTze8Sa4dY4HwDjdRD9nb03zEtH+sGeQTd+Sd xkTwx6wwSvVz1+OxM3ahg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:edIvNvmKp6E=:htxy/QU3Lu5H+T3ONDZ9HK q+TbU7E9zmz0/ltpDOf36LqeWjJmM0THO6N9Wxf2CHTyqCnNk229s5plNlhyHnrJCJXueC44D zb09c+wU/zZvNIHaTVMEbGM1swr/UgjJ4XM/7ZsJcIszl3KxarV02lwwKCC1v4KZxz04/QJpR MpyU9xMPJy0TX9eec3BFAFb3emk0pddcWw+SZvUbjxcY0GVtwascEtwN9TTGa6Q6+fb+4bscY BlgEz+NjJstt+7qZQ4qhXIDrr3iIL9y3BBL1g969nFZIAtPUoQw/dlJb/WJN3LDVFPHLwumFh meIKKxd90l112sVk4e+5l7pDHDLvE3vq1CWlBE1ZaoC0zcqdlZBm1FLHue4tTvZHV/2d0CjZa DKY8DIog1ox4wHHg4qtShueu4QTD6sW/H+WHsucokM1SKPcMJ277Fkhx6B1L8e7/cgJMXoK49 Wz3EMt8dPacZdTEKj8UuHW9OHt3lKNhdoOPkoDDXM0NNmm9xY9dhcFmRkzBUKDNEj6ZT1rgs1 iKSLG968fOqHqZ+oSk9ttAjy0N5op8YHSq6KtILAT/wInP4eS7PTg789LY+r2QXARtv9/VMm5 VqD+ve9tmEtx92vFmTGh/RAzeTYwwkG8q6dWZRj49WH0LbXHz+R1L9xSjJWLD0s1lwRa2gBIZ 8wa9943LxehbeC9Cl4E3q/aVJn9pREl+M2m0hVCD7boybp41PJ5XpU6a5aZTsXS+HeF6BN36o q43QO6B+SGKpjoUZyKTRkZAS1F9SCiC2QdQ++A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 32-bit architectures, we see a warning when %ld is used to print a size_t: In file included from drivers/scsi/lpfc/lpfc_init.c:62: drivers/scsi/lpfc/lpfc_init.c: In function 'lpfc_new_io_buf': drivers/scsi/lpfc/lpfc_logmsg.h:62:45: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Werror=format=] This is harmless, but portable code should just use %zd to avoid the warning. Fixes: 0794d601d174 ("scsi: lpfc: Implement common IO buffers between NVME and SCSI") Signed-off-by: Arnd Bergmann --- drivers/scsi/lpfc/lpfc_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.0 diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 3b5873f6751e..6e6bd1b3237d 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -4090,7 +4090,7 @@ lpfc_new_io_buf(struct lpfc_hba *phba, int num_to_alloc) /* Sanity check to ensure our sizing is right for both SCSI and NVME */ if (sizeof(struct lpfc_io_buf) > LPFC_COMMON_IO_BUF_SZ) { lpfc_printf_log(phba, KERN_ERR, LOG_FCP, - "6426 Common buffer size %ld exceeds %d\n", + "6426 Common buffer size %zd exceeds %d\n", sizeof(struct lpfc_io_buf), LPFC_COMMON_IO_BUF_SZ); return 0; From patchwork Mon Mar 4 19:39:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 159572 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4138656jad; Mon, 4 Mar 2019 11:39:57 -0800 (PST) X-Google-Smtp-Source: APXvYqxShBUErlO1cO2pba4FI4UsavaHi8p8RsPVsqCe0mTu8cfIMduRIGxcd15WA+F81jqXygQ1 X-Received: by 2002:a63:cf4c:: with SMTP id b12mr20077411pgj.316.1551728397627; Mon, 04 Mar 2019 11:39:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551728397; cv=none; d=google.com; s=arc-20160816; b=UhRrDO0Zx1IIvd3QMvNtDirsjoJt+ptTPsjKs/GyFM9To83tM2tYmyKqh7NRbHGK+V txP4YudCa3foweCzinomHI8BshPBFUna+gD8VUcTjrdQ4POpLX9h2rSgGOSJF3NsDsy5 8U++fhFpIpRU3cGjQ6VK3qBV71ugDZC6sddJMDsMH6yUMzrhRqGhtzKPFfshQoT3nU09 s4bAI6RaB9onpcmUE9ysMAT0gXZJ1tvRbouLsL7s16ks0sOCa5V2qJWU2j3zjZyZ42ak 8UCzwGK0m72NOw0mVKan3ArR2JE4bPYX+QEx1wWqlDWMKolmRbpSTA+13HkAKDaZbHQz q5hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nSzk9N1TE0xzLEq4TdUeEExogMJEw3ArXBHhx7l2T0Y=; b=IB10qQneXrESve/gtk+1zX7jxZW/XHR6UjfwHi2fL+GoIgG49Iqwsd4WtSiUxLXTSH JeLz7SzuwC1kfuA1YbO4i9+Bqr4BFwlFK7uJP81rzqnhJqVZZJXmGmEjFZwiySTmXaK4 TmAL3eCLyLREit1IDNIOgGg4+MUhZbpkhEUXiyXZgM9wxgbX0FRQcn+QV8FLVeAYHvca YpZyCJ0Yl2ybi8/Pq5mq5WyF3Y/PP4mFMZTXGJIwUU9G8x6OHzdu75Rv0WW2Rinl/axy jq6d6jfkAafVYlJ34kZ0DYjfKCnlXsMi2n08GQOmBZtARavl4svFH/cIi9qeFHN8VT3I Cydw== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k13si6072279pgh.501.2019.03.04.11.39.57; Mon, 04 Mar 2019 11:39:57 -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 S1726334AbfCDTjz (ORCPT + 31 others); Mon, 4 Mar 2019 14:39:55 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:36607 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726054AbfCDTjy (ORCPT ); Mon, 4 Mar 2019 14:39:54 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1MrQN5-1hM99S1SQ3-00oWXc; Mon, 04 Mar 2019 20:39:37 +0100 From: Arnd Bergmann To: qla2xxx-upstream@qlogic.com, "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Himanshu Madhani , Quinn Tran , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] scsi: qla2xxx: avoid printf format warning Date: Mon, 4 Mar 2019 20:39:10 +0100 Message-Id: <20190304193917.702601-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190304193917.702601-1-arnd@arndb.de> References: <20190304193917.702601-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:lCcda1YpPw9M+ZtzSbGvp7ECbDox9Y2czsNlWu8nPeD1QnKypkn 3RCtpNbxrvn/CRomx0tdkFzOCd6j0rBeGqgzlISGvYplxOECqu/jeFo/EhBtEqvyMTsWfF+ G0OECMhPbnHGqZ3qQ9cffrFZcsU3iqbsQYO2qQgTXB0fZkDWarVMJLVUkyGxsMV8dWc2BTD uTsOH5LrhJcDaeu5qBlNw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:qV24WC/GyAE=:fa5fNZ/WYTRMsV3nDc72BR oI3/uB0ISYdDKUwzki/EiHmxi9d32AZ9fxOWsK3VHmH8sl7AF0c34eEknDWWfzNt3Z4vg4nkC QVzXZmDD1FI2S49mgtyQxtfsgUpFoGlqVDbt3jwaTAf0YdYEjSBGaOrM1n1Mhsr7ffMVgFBHf OIr81U4zq3jfyJCjcDMRrep6vxUflMiAKvG5VixCWSQ4puXPURxGDt853YiV+d3wqJtMrkuHg x4cEqXMAGKOminLVsYrHSH7QHH5WWNEXBEJ8TE01O5r0GtgAGz2Xmp6nVEOn1oogyMqmhN1za aWmCaX0bXjrgi2CHY+BDJ13VdQ5Wl4MkYg9o+DbyhQqNDY+4SLdhc20uZMz0ySziKIYYgHORt xVEoV5yBWoMOUP6DiKPppcG6/vYPDLrNhu25C9Fs6OMmy4uO630at5eU5gJT8GFGHE3T8Pk2D xpPzhO8AZ8fY2WK/1UZ0h48pPN8vaL6axHFBaT77VnHHJzyL34K/CUfRkxXSybk941KX/gXH/ TGZjGz5gaTYWdcj1V+mPeZ4UWsmSGvEdKClyhb7QSVxcqizoVSY4CCmKSh5etZKSkC/HhtR7a SijgBEv0muTE7/QioemOxg//yLCf6lGtoRYTQH/gjnk0FsEJ3XScevfqvl3NNAJJHrKgoO2i4 P7YOLcPNa2cW+TVQRYocztT6y5gHKWg0ztD3TSXR5Hm+GVlGK16WZen/qS3c1FBOJNHSMGgj3 wGYFinwrQ5jOAsANzTskJ7YaqUtRacsPiVO5gQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Depending on the target architecture and configuration, both phys_addr_t and dma_addr_t may be smaller than 'long long', so we get a warning when printing either of them using the %llx format string: drivers/scsi/qla2xxx/qla_iocb.c: In function 'qla24xx_walk_and_build_prot_sglist': drivers/scsi/qla2xxx/qla_iocb.c:1140:46: error: format '%llx' expects argument of type 'long long unsigned int', but argument 6 has type 'dma_addr_t' {aka 'unsigned int'} [-Werror=format=] "%s: page boundary crossing (phys=%llx len=%x)\n", ~~~^ %x __func__, sle_phys, sg->length); ~~~~~~~~ drivers/scsi/qla2xxx/qla_iocb.c:1180:29: error: format '%llx' expects argument of type 'long long unsigned int', but argument 7 has type 'dma_addr_t' {aka 'unsigned int'} [-Werror=format=] "%s: sg[%x] (phys=%llx sglen=%x) ldma_sg_len: %x dif_bundl_len: %x ldma_needed: %x\n", ~~~^ There are special %pad and %pap format strings in Linux that we could use here, but since the driver already does 64-bit arithmetic on the values, using a plain 'u64' seems more consistent here. Note: A possible related issue may be that the driver possibly checks the wrong kind of overflow: when an IOMMU is in use, buffers that cross a 32-bit boundary in physical addresses would still be mapped into dma addresses within the low 4GB space, so I suspect that we actually want to check sg_dma_address() instead of sg_phys() here. Fixes: 50b812755e97 ("scsi: qla2xxx: Fix DMA error when the DIF sg buffer crosses 4GB boundary") Signed-off-by: Arnd Bergmann --- drivers/scsi/qla2xxx/qla_iocb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.20.0 Acked-by: Himanshu Madhani diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c index 63f8e3c19841..456a41d2e2c6 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -1132,7 +1132,7 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp, /* if initiator doing write or target doing read */ if (direction_to_device) { for_each_sg(sgl, sg, tot_dsds, i) { - dma_addr_t sle_phys = sg_phys(sg); + u64 sle_phys = sg_phys(sg); /* If SGE addr + len flips bits in upper 32-bits */ if (MSD(sle_phys + sg->length) ^ MSD(sle_phys)) { @@ -1178,7 +1178,7 @@ qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *ha, srb_t *sp, ql_dbg(ql_dbg_tgt + ql_dbg_verbose, vha, 0xe023, "%s: sg[%x] (phys=%llx sglen=%x) ldma_sg_len: %x dif_bundl_len: %x ldma_needed: %x\n", - __func__, i, sg_phys(sg), sglen, ldma_sg_len, + __func__, i, (u64)sg_phys(sg), sglen, ldma_sg_len, difctx->dif_bundl_len, ldma_needed); while (sglen) { From patchwork Mon Mar 4 19:39:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 159573 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp4139781jad; Mon, 4 Mar 2019 11:41:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxxzDHCtJdoeAf5QZd4IUWh0McJMfgFuq91cF//9fVD//OU4l36DRCnFJYRXP7ctaPyEkxN X-Received: by 2002:a63:4a20:: with SMTP id x32mr20296055pga.429.1551728491868; Mon, 04 Mar 2019 11:41:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551728491; cv=none; d=google.com; s=arc-20160816; b=pqU4D1Jo9ICsddcTN8R6xcHXgNjWJ5jogArsBXwrfvvJscQOoSoL8eCogy6IWPfvKe NR3ukW3X78H6z9xEw6P+T6sYLK3ZO/rgSe6bTqyEXZdBYL2XLl4F7qvtgEMsUjd/pGe9 Eksesehn3Eo0helb3TtipWDTxNHntq8Tjp67HMqhWOcEUWaMcLof4kbgI1LfAzak02gS XvUBUq+eW4f87L0d3skV3zt2p6IYfP//EBpel5VJ4fBeryfSGRE2hOLnWBtEV3yKfart dpXnxQsqk0oAgxiOJRnFLhnmSWhwKguIIxl2NJFM69aaaA4crAPm8i7dQYxAEDdCfvTm CbQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=PhoHsI3g5ITIJUqMOJfhg2sMo0W671dptDjrZh4VY0E=; b=yAAtYeV720FkmSWR2TGqj2u+8gU/Qu97/spG5fWED32/nQyFC5Ueqfr9boNghCnbx9 fgHYYQFL7bEe7uhmGpcqC4+wKK5zZV45HtcEsz4UvI8DPKLQ/w16rob3kvMsKZ0RnyGu FP67KbQhCyL2UywwvP1M3VY0yqZaHmsq5fRipNXkTV2B/Q5REeHeXvVvKSRbAFW9iIuC arpj339saxwn32mmJJBytUYF0D2Rqt+SM4cqEUunjZij6ldCadFm48hdzr2HiRqIaKfH yW7++IxkPgGGMIP6C0lB5bFsQSoUmOAd2ApBTWXo0Z/r4cAxbh5ZNEs1Tg/+2bYUPseO puww== ARC-Authentication-Results: i=1; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g186si5692044pgc.586.2019.03.04.11.41.31; Mon, 04 Mar 2019 11:41:31 -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 S1726270AbfCDTla (ORCPT + 31 others); Mon, 4 Mar 2019 14:41:30 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:38145 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726061AbfCDTl3 (ORCPT ); Mon, 4 Mar 2019 14:41:29 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.129]) with ESMTPA (Nemesis) id 1N3bb1-1hA01h3Zcx-010fdQ; Mon, 04 Mar 2019 20:40:58 +0100 From: Arnd Bergmann To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Alim Akhtar , Avri Altman , Pedro Sousa , Wei Li , Subhash Jadavani , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] scsi: ufs: hisi: fix ufs_hba_variant_ops passing Date: Mon, 4 Mar 2019 20:39:11 +0100 Message-Id: <20190304193917.702601-4-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190304193917.702601-1-arnd@arndb.de> References: <20190304193917.702601-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:iDV3wbl1jv0zwUySViRu9AW+5mW6LMS14QEtSMcadmyPsv4Df8/ u07BlmQ9TjYCgDNrvZ1eE6oJFOMi06PTI64CYLTPIgMKYPd1ySpKzxyWdWdYArHiyLEZZtQ 1bBf3jsi6ueg6KTf2kTN8Be9CvEoOIxaXjJySentrCKRtHWNmujZ1jl5BAq4g/chPNw7VpV jB64phSxE4cSXcCZPRx+g== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:FnSvrfJJWHo=:BzQ859kEH/Jrbpck8dqDH/ cwBRmsFEt9xhn5mb5/y/2OcDaQy5U4ncLDc08VTmY4e48K0aSqgXszcyocZ4pYY0gCyiqD2m9 yXcPgX6kbJmZL2Bdy2Rl+0XmTJk2hGLZ9DWWq6Ovtu6FhiLOj7lQrlD+nqFbDLd8TdGkUTBVx kHTqJmDZ0FF9y3qbFw56fnxkHzS7R9f6+rfNUG5S05Dtnn8FOBiInPyN6PPyNpvSwEYwit7y7 DBdLocgCXf4O5TGGtPnm+gRA94NFy4WsFcViBv3/CIKh6vsXspX660YJ6nVMTXCvYKFUkMI8p 1ZOmnMF2pnQLG0va/UN9RzYQBwZ5o497Z1EASU8wN1bGuO2bnZt7Jf/J5QKszrI5m9JHyCsq+ hVWtT8SrW89RiK01HLfQWHIrzRX7FVi/72RBsOGFXM0Hc8O0/cguWFDIOBVphXqAnalSMypfa 6tNQ8IyJkcgpubQejhCnJb73ySUAZ8TL/JqPpA8AhX/zkbI26iVMKamwLT+GAysYnXSeG1wFZ UZctqgKguW5c/tdx5FczJEQ8U16oS+S8Dd8VUbLqsnwXLRG7OWllxrIO7AwwEU0OJx5mAzl6C 1ykmzvc6LPb3CS5jv1+m3lj/OFwYyAnyA7Ph/AtgiLydFSDkCx8kO9HTaN166U11Tcy5cktfQ L7kjxCvDzjMOtxTQ06aXC0YfMFtMj6L+pPbtUWd8OzDcGMjSuE42YDu89KRXvhv5FffE3T4/w 3LiJzzylegOglkz5SmmGOhyacvoJrAbTZdcd/g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Without CONFIG_OF, the of_match_node() helper does not evaluate its argument, and the compiler warns about the unused variable: drivers/scsi/ufs/ufs-hisi.c: In function 'ufs_hisi_probe': drivers/scsi/ufs/ufs-hisi.c:673:17: error: unused variable 'dev' [-Werror=unused-variable] Rework this code to pass the data directly, and while we're at it, correctly handle the const pointers. Fixes: 653fcb07d95e ("scsi: ufs: Add HI3670 SoC UFS driver support") Signed-off-by: Arnd Bergmann --- drivers/scsi/ufs/ufs-hisi.c | 11 ++++------- drivers/scsi/ufs/ufshcd-pltfrm.c | 2 +- drivers/scsi/ufs/ufshcd-pltfrm.h | 2 +- drivers/scsi/ufs/ufshcd.h | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) -- 2.20.0 Reviewed-by: Avri Altman diff --git a/drivers/scsi/ufs/ufs-hisi.c b/drivers/scsi/ufs/ufs-hisi.c index f2d3df357a97..0e855b5afe82 100644 --- a/drivers/scsi/ufs/ufs-hisi.c +++ b/drivers/scsi/ufs/ufs-hisi.c @@ -640,7 +640,7 @@ static int ufs_hi3670_init(struct ufs_hba *hba) return 0; } -static struct ufs_hba_variant_ops ufs_hba_hi3660_vops = { +static const struct ufs_hba_variant_ops ufs_hba_hi3660_vops = { .name = "hi3660", .init = ufs_hi3660_init, .link_startup_notify = ufs_hisi_link_startup_notify, @@ -649,7 +649,7 @@ static struct ufs_hba_variant_ops ufs_hba_hi3660_vops = { .resume = ufs_hisi_resume, }; -static struct ufs_hba_variant_ops ufs_hba_hi3670_vops = { +static const struct ufs_hba_variant_ops ufs_hba_hi3670_vops = { .name = "hi3670", .init = ufs_hi3670_init, .link_startup_notify = ufs_hisi_link_startup_notify, @@ -669,13 +669,10 @@ MODULE_DEVICE_TABLE(of, ufs_hisi_of_match); static int ufs_hisi_probe(struct platform_device *pdev) { const struct of_device_id *of_id; - struct ufs_hba_variant_ops *vops; - struct device *dev = &pdev->dev; - of_id = of_match_node(ufs_hisi_of_match, dev->of_node); - vops = (struct ufs_hba_variant_ops *)of_id->data; + of_id = of_match_node(ufs_hisi_of_match, pdev->dev.of_node); - return ufshcd_pltfrm_init(pdev, vops); + return ufshcd_pltfrm_init(pdev, of_id->data); } static int ufs_hisi_remove(struct platform_device *pdev) diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c index 895a9b5ac989..27213676329c 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -297,7 +297,7 @@ static void ufshcd_init_lanes_per_dir(struct ufs_hba *hba) * Returns 0 on success, non-zero value on failure */ int ufshcd_pltfrm_init(struct platform_device *pdev, - struct ufs_hba_variant_ops *vops) + const struct ufs_hba_variant_ops *vops) { struct ufs_hba *hba; void __iomem *mmio_base; diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.h b/drivers/scsi/ufs/ufshcd-pltfrm.h index df64c4180340..1f29e1fd6d52 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.h +++ b/drivers/scsi/ufs/ufshcd-pltfrm.h @@ -17,7 +17,7 @@ #include "ufshcd.h" int ufshcd_pltfrm_init(struct platform_device *pdev, - struct ufs_hba_variant_ops *vops); + const struct ufs_hba_variant_ops *vops); void ufshcd_pltfrm_shutdown(struct platform_device *pdev); #ifdef CONFIG_PM diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 69ba7445d2b3..ecfa898b9ccc 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -546,7 +546,7 @@ struct ufs_hba { int nutrs; int nutmrs; u32 ufs_version; - struct ufs_hba_variant_ops *vops; + const struct ufs_hba_variant_ops *vops; void *priv; unsigned int irq; bool is_irq_enabled;