From patchwork Wed Dec 6 14:14:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 120847 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp7109420qgn; Wed, 6 Dec 2017 06:15:27 -0800 (PST) X-Google-Smtp-Source: AGs4zMbZtuQsDj01SPiKW9YXASYD6HMp7G9OtHW8dc7A1HVn6NFIJIhBV6RI80Elp6BycXPZy6Xm X-Received: by 10.98.202.217 with SMTP id y86mr3000398pfk.118.1512569726928; Wed, 06 Dec 2017 06:15:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512569726; cv=none; d=google.com; s=arc-20160816; b=DdPBeSTQZhxK0fpZe0vtAFcze65x89b1YcJdiJAU6BFb1mOEhiMTsSiNnlgocXuJkM 66az1s09gm9OxP75lxAL5OeaSVEdlf3MKRGPkh/xfEGDygqmCwNRozgRtOGKOkVr77KJ so5Stp2MJ852IaH09Dm1XfudW5pJBuOmKDit8+9fVbIEFDbNkESNY2TC2Ic9XQTbgCgv UD+NoKJCdE8Gv/fi8BR2KKRi5wIqdvAV4duPRWP+rNdQecNU74qLiG7UyEXqF0/FM64M hdcnlReTp18sjDyg8fCz4bJs5aZBbufQkITVEgVLKmOlhoi3GXxXgPw90yNm/No9Ki+M c4fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GIeJLf6NFysgzYxJMqd5bbl5dueM2Bhp91OO8W01Kys=; b=Pp7qS03hLQXWv+ZDjjQNuZkFTjowcPkItYDbuc1OB+PXvJBqAzfMkIZNUkZSU2F2RD 1OkyVaY/yAPcW0Uok7IUkmTwzYcOocCx3L0e/VhtYm7WNJADHUjqtdu72qFu531K+4q/ m+GIdRixSXPRVjP58HxbKjx5jYaijsGZdCs+nutWSswZw2FTVTOSHt4HjuHZ/QRHAPKJ 0uAbT6VKgx3u2SN1TqiRpLsEoZ3wl39J+8Lnsag8qsNedx9L03lw2Rznz8TtRHflgapv gqJPYB8r6MBnsWszqxRMonS55x3uASmq8t2ttDWDlgWM3N+y5kl5vYoek8uudnaK0vZf QFjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 q2si1955884pgd.81.2017.12.06.06.15.26; Wed, 06 Dec 2017 06:15:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752218AbdLFOP0 (ORCPT + 1 other); Wed, 6 Dec 2017 09:15:26 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:50717 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751964AbdLFOPG (ORCPT ); Wed, 6 Dec 2017 09:15:06 -0500 Received: from wuerfel.lan ([149.172.96.106]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0Lxftz-1fA5d73NqV-017BMJ; Wed, 06 Dec 2017 15:14:46 +0100 From: Arnd Bergmann To: Anil Gurumurthy , Sudarsana Kalluru , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Johannes Thumshirn , Hannes Reinecke , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: bfa: fix type conversion warning Date: Wed, 6 Dec 2017 15:14:18 +0100 Message-Id: <20171206141444.634681-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:GLSoyMLpFfhW24aZGB1yQa/nOaKBxEsvSshZ5WqL7MeszppqQTG ov8Y3ga4XSHeOyLqB3EXvjJCaj0JY4h8hR6T589gZEpELChm9QNicCon/kGLRKZxB8AobUD S3RXjrd4fWu5KUejJZq/FSna/ioOaFf/4R4EaTI0+18n+A9lHj0xisLfa29vzNJiT/8tYfE F2Df3DWO7znCtA/ydp7ng== X-UI-Out-Filterresults: notjunk:1; V01:K0:9lskR5Gbfvo=:l5kPxYyoQtozbB5M3C0fu8 wiT3MTv/4/dAdKEz6DaFJq6ZwGxBwN8JOs/OI4tNQ+2YqSATz55d7LJp/hil8Yp4wHctD5qkv toQ6Pqv91tyiUqyNVH9RO+BwYMDVEAzCwYDeU7jAL8JaRcsKLLtCVEojVUJujIKFz/i4FtoBC Ss7yeOQLdSAgsn5nowt4qfnVhvpp3DDT1XnLDrHft2A7MNV8FM5OCntudQRri2dJ3T+2E32tj fzU3xK69Nx4Ow75BGO+PmF5onNZhZG5epGXb/bV49byghCdJcc19PrDrF+ip7J/6RLzdXckfw 8o9qwp3MrvYkdRgSGeroIyNgFqLqrDIvR/0Br+TFrpXrugfZGI10/zDvHSVaqsOet5Rp5wwQS ibfwE0BI8GksS1UKTehCeOFR97nwMmr+7O9LqvaaUVkGTn3ziJai6janUGRKjYHMwwLPozTQq e5dk8ZxioOsk31xSlO+SkVXUOaR611aBKwwMyEdUYZtxxvQt9fPcyhVTxKVzjFrlOo6onQWCU SyYA+qf5k78c/W0Ez0DWPsvz//UiiruqNtISY5QBCZ8MaLIUHvK1nvkmx9WHk+TIykXRkSMaR c5MD5+tg6O98XxVOBtLrlCASQnxEHU5abYdKRUPLJp6juLPdbgY0SDKMCXEik5RbNr4g1JysH rf7GQl/n52mKc3L4mvcIOml/Cl4mSqZYBPyBTLq5xhXGuIJlh5D5uA2GF/CcIKHMmGHgNPC1Z Vah1ON+QHV2YjWC7ebbrTifpYcbiw2Io2VYINw== Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org A regression fix introduced a harmless type mismatch warning: drivers/scsi/bfa/bfad_bsg.c: In function 'bfad_im_bsg_vendor_request': drivers/scsi/bfa/bfad_bsg.c:3137:35: error: initialization of 'struct bfad_im_port_s *' from 'long unsigned int' makes pointer from integer without a cast [-Werror=int-conversion] struct bfad_im_port_s *im_port = shost->hostdata[0]; ^~~~~ drivers/scsi/bfa/bfad_bsg.c: In function 'bfad_im_bsg_els_ct_request': drivers/scsi/bfa/bfad_bsg.c:3353:35: error: initialization of 'struct bfad_im_port_s *' from 'long unsigned int' makes pointer from integer without a cast [-Werror=int-conversion] struct bfad_im_port_s *im_port = shost->hostdata[0]; This changes the code back to shost_priv() once more, but encapsulates it in an inline function to document the rather unusual way of using the private data only as a pointer to the previously allocated structure. I did not try to get rid of the extra indirection level entirely, which would have been rather invasive and required reworking the entire initialization sequence. Fixes: 45349821ab3a ("scsi: bfa: fix access to bfad_im_port_s") Signed-off-by: Arnd Bergmann --- drivers/scsi/bfa/bfad_bsg.c | 4 ++-- drivers/scsi/bfa/bfad_im.c | 6 ++++-- drivers/scsi/bfa/bfad_im.h | 10 ++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) -- 2.9.0 diff --git a/drivers/scsi/bfa/bfad_bsg.c b/drivers/scsi/bfa/bfad_bsg.c index fa9a966e2c2a..3976e787ba64 100644 --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c @@ -3134,7 +3134,7 @@ bfad_im_bsg_vendor_request(struct bsg_job *job) struct fc_bsg_reply *bsg_reply = job->reply; uint32_t vendor_cmd = bsg_request->rqst_data.h_vendor.vendor_cmd[0]; struct Scsi_Host *shost = fc_bsg_to_shost(job); - struct bfad_im_port_s *im_port = shost->hostdata[0]; + struct bfad_im_port_s *im_port = bfad_get_im_port(shost); struct bfad_s *bfad = im_port->bfad; void *payload_kbuf; int rc = -EINVAL; @@ -3350,7 +3350,7 @@ bfad_im_bsg_els_ct_request(struct bsg_job *job) { struct bfa_bsg_data *bsg_data; struct Scsi_Host *shost = fc_bsg_to_shost(job); - struct bfad_im_port_s *im_port = shost->hostdata[0]; + struct bfad_im_port_s *im_port = bfad_get_im_port(shost); struct bfad_s *bfad = im_port->bfad; bfa_bsg_fcpt_t *bsg_fcpt; struct bfad_fcxp *drv_fcxp; diff --git a/drivers/scsi/bfa/bfad_im.c b/drivers/scsi/bfa/bfad_im.c index 24e657a4ec80..c05d6e91e4bd 100644 --- a/drivers/scsi/bfa/bfad_im.c +++ b/drivers/scsi/bfa/bfad_im.c @@ -546,6 +546,7 @@ int bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port, struct device *dev) { + struct bfad_im_port_pointer *im_portp; int error = 1; mutex_lock(&bfad_mutex); @@ -564,7 +565,8 @@ bfad_im_scsi_host_alloc(struct bfad_s *bfad, struct bfad_im_port_s *im_port, goto out_free_idr; } - im_port->shost->hostdata[0] = (unsigned long)im_port; + im_portp = shost_priv(im_port->shost); + im_portp->p = im_port; im_port->shost->unique_id = im_port->idr_id; im_port->shost->this_id = -1; im_port->shost->max_id = MAX_FCP_TARGET; @@ -748,7 +750,7 @@ bfad_scsi_host_alloc(struct bfad_im_port_s *im_port, struct bfad_s *bfad) sht->sg_tablesize = bfad->cfg_data.io_max_sge; - return scsi_host_alloc(sht, sizeof(unsigned long)); + return scsi_host_alloc(sht, sizeof(struct bfad_im_port_pointer)); } void diff --git a/drivers/scsi/bfa/bfad_im.h b/drivers/scsi/bfa/bfad_im.h index 7f7616c52814..af66275570c3 100644 --- a/drivers/scsi/bfa/bfad_im.h +++ b/drivers/scsi/bfa/bfad_im.h @@ -69,6 +69,16 @@ struct bfad_im_port_s { struct fc_vport *fc_vport; }; +struct bfad_im_port_pointer { + struct bfad_im_port_s *p; +}; + +static inline struct bfad_im_port_s *bfad_get_im_port(struct Scsi_Host *host) +{ + struct bfad_im_port_pointer *im_portp = shost_priv(host); + return im_portp->p; +} + enum bfad_itnim_state { ITNIM_STATE_NONE, ITNIM_STATE_ONLINE,