Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4434106pxb; Mon, 21 Feb 2022 21:29:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJz5aDUfAXjW360SywhRizWFtYoBJOB/i6OAUq9MUqOU6Ymk0OhlEpst9CfMvEfwab2l1VD8 X-Received: by 2002:a65:6045:0:b0:368:e62c:cdc4 with SMTP id a5-20020a656045000000b00368e62ccdc4mr18423956pgp.138.1645507793420; Mon, 21 Feb 2022 21:29:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645507793; cv=none; d=google.com; s=arc-20160816; b=HO3Q+XK73MeRk5gxfSE9jgxW2eflvGtt7bqUEI0KOBENTVqC5ZMYLtKWDeG71myA5L /zO4nIjkslhlhdlDOHaYw11MMWX4q4ErqAbe9ePMSWem+miFbVDrVJSOah8f4P+j0Tda QymED/PWu7JeRFKlfPBaj0s+tfTprY/pFKKzdPBSC+WbSJ0x+X8LT1sIl2jtGaBqz0po 1KgIhuBSIb/yJmuKE4/i0JF2TN4FlARYSRgG6CWtE/Sxp7effYg6/5eQaSPXe1Ki/X+K HWdJQbLCgEgsE7EQndhN5P0Xvjo0q27h9Qyr0zIX50cG4ygtP22nS6daukgXFXV+V7xM zSpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:subject:from:message-id:cc:to :dkim-signature; bh=6imnI/zZbKqPNPFvmFE1m1mDE+tzBp4CGoapLd8H0Ak=; b=to/9d0DmTOx6zRziLfOyaZCbX/gg6oF13J31o/Rrhc0D+IcLW1IxRXa3WQfgS5HwhX GeF29lpIt41HRq9HoJNEIsqEFvW4+24VaFGj0MiA2qbBDwUk7Y7Wl9ahjvdu+b4okG1o 38kDnGI93MX1/ZZiiC5s1MTL0IrSqarX/wOMAWcYAcDQoDaiLPYXtGvWHhH+KJbv2MXF cjY7/9l4ruI8KML8n/bIBbSrGDp5QZhnuieAkYmL4Av44QOG403CMWEKUiva8vR5YW4W 9SNc0YeHO2+r9sS4snUovgSmsh+oHAoFEEBXXEh86lnAJVOZJBxe8XgCnwEyaG51+6j0 eOJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=W+yvzUKn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g7si3527232pll.318.2022.02.21.21.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:29:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=W+yvzUKn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5070910A7D0; Mon, 21 Feb 2022 20:58:42 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237125AbiBUXlX (ORCPT + 99 others); Mon, 21 Feb 2022 18:41:23 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237083AbiBUXlT (ORCPT ); Mon, 21 Feb 2022 18:41:19 -0500 X-Greylist: delayed 602 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 21 Feb 2022 15:40:54 PST Received: from wnew4-smtp.messagingengine.com (wnew4-smtp.messagingengine.com [64.147.123.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93B3D240AB; Mon, 21 Feb 2022 15:40:54 -0800 (PST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 980FA2B00246; Mon, 21 Feb 2022 18:23:56 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 21 Feb 2022 18:23:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:date:date:from:from:in-reply-to :message-id:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=6imnI/ zZbKqPNPFvmFE1m1mDE+tzBp4CGoapLd8H0Ak=; b=W+yvzUKn52dBRw5CTupp+s 3uwzSYWym16KC79u5k+NqGaMbHsDHdVPlD4jfo62XpMF8D5dv8my0/9e/dD+NO8q LZBA+O4LdG6Mw89BDX5v3xemwvUtqQfeB7CT64EfZ15RZGwB3CLmVPBjAk8lzN4M UuqX9GPrJK34sKTY8tZkfOiDRf5tixR4H4s1uMAyzJRmJLpJCdQOKBLzaAlfBzDl LTJGq/YthJTTrjSCS8mh6ODmoRDvWWie5lBIs5A0YUU+51NES5PRNfuJVmqJHV+i UMZ6KxVY3B5+eBekg3NTD01+5XAaCjtUHajQ7sAGba+S1CkPsYYe1Y7Ce8wxMadA == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrkeejgddtlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenog fhohhrsghiugguvghnjfgurhculdehtddtmdenucfjughrpefvkffhufffsedttdertddt tdenucfhrhhomhephfhinhhnucfvhhgrihhnuceofhhthhgrihhnsehlihhnuhigqdhmie ekkhdrohhrgheqnecuhfhorhgsihguuggvnhfjughrpefvkffhufffsedttdertddttddp vffkhffuffestddtredttddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepfhhthhgrihhnsehlihhnuhigqdhmieekkhdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 21 Feb 2022 18:23:53 -0500 (EST) To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Message-Id: From: Finn Thain Subject: [PATCH] mesh: Stop using struct scsi_pointer Date: Tue, 22 Feb 2022 10:09:42 +1100 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This driver doesn't use SCp.ptr to save a SCSI command data pointer which means "scsi pointer" is a complete misnomer here. Only a few members of struct scsi_pointer are used and the rest waste memory. Avoid the "struct foo { struct bar; };" silliness. Signed-off-by: Finn Thain --- drivers/scsi/mesh.c | 19 +++++++++---------- drivers/scsi/mesh.h | 10 +++++----- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index de9ae36def42..322d3ad38159 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c @@ -586,12 +586,12 @@ static void mesh_done(struct mesh_state *ms, int start_next) ms->current_req = NULL; tp->current_req = NULL; if (cmd) { - struct scsi_pointer *scsi_pointer = mesh_scsi_pointer(cmd); + struct mesh_cmd_priv *mcmd = mesh_priv(cmd); set_host_byte(cmd, ms->stat); - set_status_byte(cmd, scsi_pointer->Status); + set_status_byte(cmd, mcmd->status); if (ms->stat == DID_OK) - scsi_msg_to_host_byte(cmd, scsi_pointer->Message); + scsi_msg_to_host_byte(cmd, mcmd->message); if (DEBUG_TARGET(cmd)) { printk(KERN_DEBUG "mesh_done: result = %x, data_ptr=%d, buflen=%d\n", cmd->result, ms->data_ptr, scsi_bufflen(cmd)); @@ -605,7 +605,7 @@ static void mesh_done(struct mesh_state *ms, int start_next) } #endif } - scsi_pointer->this_residual -= ms->data_ptr; + mcmd->this_residual -= ms->data_ptr; scsi_done(cmd); } if (start_next) { @@ -1173,7 +1173,7 @@ static void handle_msgin(struct mesh_state *ms) if (ms->n_msgin < msgin_length(ms)) goto reject; if (cmd) - mesh_scsi_pointer(cmd)->Message = code; + mesh_priv(cmd)->message = code; switch (code) { case COMMAND_COMPLETE: break; @@ -1264,7 +1264,7 @@ static void set_dma_cmds(struct mesh_state *ms, struct scsi_cmnd *cmd) if (cmd) { int nseg; - mesh_scsi_pointer(cmd)->this_residual = scsi_bufflen(cmd); + mesh_priv(cmd)->this_residual = scsi_bufflen(cmd); nseg = scsi_dma_map(cmd); BUG_ON(nseg < 0); @@ -1594,13 +1594,12 @@ static void cmd_complete(struct mesh_state *ms) break; case statusing: if (cmd) { - struct scsi_pointer *scsi_pointer = - mesh_scsi_pointer(cmd); + struct mesh_cmd_priv *mcmd = mesh_priv(cmd); - scsi_pointer->Status = mr->fifo; + mcmd->status = mr->fifo; if (DEBUG_TARGET(cmd)) printk(KERN_DEBUG "mesh: status is %x\n", - scsi_pointer->Status); + mcmd->status); } ms->msgphase = msg_in; break; diff --git a/drivers/scsi/mesh.h b/drivers/scsi/mesh.h index 1afa8b37295b..f70181acceac 100644 --- a/drivers/scsi/mesh.h +++ b/drivers/scsi/mesh.h @@ -9,14 +9,14 @@ #define _MESH_H struct mesh_cmd_priv { - struct scsi_pointer scsi_pointer; + int this_residual; + int message; + int status; }; -static inline struct scsi_pointer *mesh_scsi_pointer(struct scsi_cmnd *cmd) +static inline struct mesh_cmd_priv *mesh_priv(struct scsi_cmnd *cmd) { - struct mesh_cmd_priv *mcmd = scsi_cmd_priv(cmd); - - return &mcmd->scsi_pointer; + return scsi_cmd_priv(cmd); } /* -- 2.32.0