Received: by 10.223.185.116 with SMTP id b49csp1065771wrg; Fri, 23 Feb 2018 11:17:23 -0800 (PST) X-Google-Smtp-Source: AH8x227STEFJZu4E5/eDKWS3zQACquVzLV2h7zyD+Hc/IVsvaFUbFzcz9rm6hAVJHGKH4L3w5OpK X-Received: by 2002:a17:902:34f:: with SMTP id 73-v6mr2546847pld.55.1519413443498; Fri, 23 Feb 2018 11:17:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519413443; cv=none; d=google.com; s=arc-20160816; b=YcSh92TOSzl40Lpua51VK3BfLRbBlZYjBP/LNj9cTHzvN0i/2DT4S2D4KFFIeFj1KE RNFSY9Ctv48PrFYH1Cq0IwlWSb+lyxEQvXv8R13wTYQ3+0Cmvxsg7bcWx4ZXiDsvpKNB gT+KJdRxTAA36X+tFT2K5YXhNmdqaaqHR3OyWCr02BBRprr3q0yvRds/s1h4f8N8UCDd L7jiyG/FkZMg88JapWl+F8D4kG0aT9Ynb1k6jMvXtZq/LzRz/TQS6zmFBEK/4wKC39oK qewYNtbqiR4JYX1FIkinUPYN+jQe9jWXUrDXdArnb2nmr9V7Dit+c4cvFOhdBKV6BEhl iEog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=YJd3sDklvdLj9Kd5n/weKR4+t+xNP9GfwuJHKX4hBHI=; b=gEA2WT6yoKnKR29tFFKcYL7OZ/SohALUSqgAAlk/0ylf5kBAbiLwqb57fSve8jOVCU c37G2URQhF95/W00IF8gYHUAIaG3GHAQmnnQRTmCe+HU6H8iCY0McpeoC8Prk1Za27AC 6MbFcz+54rElOwNzPdZUv+SZqWMaQtWnSlFBP6dDdpVPE8pkdJ+mdgGh2g9cUHQlqPXY Z5zyVBX/XXn6mold7uFGISqED6lSl/irwXYH1Khv8ltrpqsY2HbZFedevNE2Iye+QUpd ctvYZwvxQxTnumR3XtE6v8WGu2E08WvnOQgSftE+VLBYG5J44OXjTDrQxWTz9xVyF50y /hYA== 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 f127si1859666pgc.49.2018.02.23.11.17.09; Fri, 23 Feb 2018 11:17:23 -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 S965093AbeBWSzN (ORCPT + 99 others); Fri, 23 Feb 2018 13:55:13 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:48080 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964831AbeBWSzK (ORCPT ); Fri, 23 Feb 2018 13:55:10 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2F59711E9; Fri, 23 Feb 2018 18:55:10 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Johannes Thumshirn , Hannes Reinecke , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 130/159] scsi: bfa: fix type conversion warning Date: Fri, 23 Feb 2018 19:27:18 +0100 Message-Id: <20180223170758.844236686@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170743.086611315@linuxfoundation.org> References: <20180223170743.086611315@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit 48d83282db077f93b2cf40de120f4d6f29eb293b upstream. 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 Reviewed-by: Johannes Thumshirn Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Cc: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- 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(-) --- a/drivers/scsi/bfa/bfad_bsg.c +++ b/drivers/scsi/bfa/bfad_bsg.c @@ -3136,7 +3136,7 @@ bfad_im_bsg_vendor_request(struct bsg_jo 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; struct request_queue *request_q = job->req->q; void *payload_kbuf; @@ -3359,7 +3359,7 @@ bfad_im_bsg_els_ct_request(struct bsg_jo { 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; --- 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 *b 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 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 --- 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,