Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp697668lqs; Tue, 5 Mar 2024 13:45:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUIr5bk1R2Ms1wiuvnWilwwuKV+TTBFlLdQVxytgtmIm6hT8UaZ7NVUEVAA14Gn4UZ82it8Ew3DnvS6AQyzVc+iWbvpaLC9hMwHyQ6uuA== X-Google-Smtp-Source: AGHT+IG/i2D9I7o43SlqAyeq+0KKCCdz9gKaNZdmLpNhg2WM45SsK4Vdk7jO5jXlzOpJjG558kr6 X-Received: by 2002:a17:90a:17ef:b0:29a:6395:a67a with SMTP id q102-20020a17090a17ef00b0029a6395a67amr5070323pja.4.1709675154610; Tue, 05 Mar 2024 13:45:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709675154; cv=pass; d=google.com; s=arc-20160816; b=Ze8AHwAslrx+8h4yYGIXQ8i86opJVRK5bYdQJx5hIxNU+FMKJGqy65V7S7IBxdmoFO m7KCUEOelcD9gFFz574F6SPhiCDclsi+XZ88lJA5vPjwIx1Tfv948W0Vo5JQl/KmQQlB XYbGx0vbnZaCAxtvWXxf1DlhhWSCvJ6dJkOh33FaTHbQ7+msZ61lJNpccAa0V79m2A4z JeGRxsoj3tVS1X7TDcKr5rL8RbUYsWuic1V1JRBU4QJsUc1qDcNaIJberl1bHgH/T3M5 8QLldmOb2/HWo5MfJmahlQxOr4f7RwPMt0qTVZLyUSkCwAuYeFazTqz/k7ybCwWTJaO8 G5UQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:wdcironportexception:ironport-sdr:ironport-sdr:dkim-signature; bh=GPfarILikU0Aoqel4lMjTCCr7CsabYhUDQ9E1X3n7Eo=; fh=lbnuh9Va1UwcnWxZPbjQjN30xhVZh+Gs5sSzMLG81NY=; b=tYXaBxJxOpZu20qrLJKDWwJ13emq/s57FH1oJeGyNui7ZKfVrmvDimCt1S/Z5hp3lY cPqRJLfZ5K38j1jWPiGtAZJHw+9Y4t4QYUg+INtwK4wPEVLz+eQyLRAKDsywCdFeoa6d FLzphw9O4pF27+nMyJw3yfPtgpPpapeUpmGMlLB0kJ3Wi4loo1C0NSDEKiSV7bpWlCKo pNy9LljDHr09x9PhQfaiFgCv7JPUH5eMZaY7inuR40F67ZTPYEDLIquEVTXu7+r1YGOX FHYPbImGzg8E6hGyS8Uxzd8AaC20uYFpqt1PgikkWVPUlo+gbhh5Tnaa+aIRtVbClz17 r6SQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wdc.com header.s=dkim.wdc.com header.b="WnMd0/Lp"; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); spf=pass (google.com: domain of linux-kernel+bounces-92984-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92984-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z23-20020a63e557000000b005cdc2cc9a1dsi10872680pgj.699.2024.03.05.13.45.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 13:45:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92984-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@wdc.com header.s=dkim.wdc.com header.b="WnMd0/Lp"; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); spf=pass (google.com: domain of linux-kernel+bounces-92984-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92984-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wdc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0EFEBB24AA1 for ; Tue, 5 Mar 2024 21:01:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8509D12BEBB; Tue, 5 Mar 2024 21:01:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="WnMd0/Lp" Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9470C12AAF9; Tue, 5 Mar 2024 21:00:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=68.232.143.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709672459; cv=none; b=b2gtFOwOGZZjQai5seRfiXD1AYsQSfl//Ix2qoNMUUmNak4x1nYZ0IIegWgGABORl7qo4N7qovxVwGmAVQ4XEGeIxZhApWINWwOo40RLQL+7qYa5v7HRZu9mTtbG6aEEeEwHjZpkF8Z1p9MTnnFVFQA4EYWVLPTxK81wW0yKxBc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709672459; c=relaxed/simple; bh=u9nBdyY2Zu/bsOk8ujnCI/Ne6Dmf1PlQ6sXI7ZNdlVQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Mbe4iLxDFbFOJjt8+IUawFa47wHJDXZDPKQh5h3nBAQzUGJTKgqI4n73oRtap9Rt8cHiUSnah3gqKi9YVzdip0Ae7lUOLk+oj2a4hCCA91OPZXGHqFZD6Q7Tn4qu64okW1lxccYLKclrs5dwH8G1vJes+K53lHOb6aIgU1dT4wU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com; spf=pass smtp.mailfrom=wdc.com; dkim=pass (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b=WnMd0/Lp; arc=none smtp.client-ip=68.232.143.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wdc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1709672457; x=1741208457; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=u9nBdyY2Zu/bsOk8ujnCI/Ne6Dmf1PlQ6sXI7ZNdlVQ=; b=WnMd0/LpsdZ8M2BtsrRIK6YjtwRAQ+cBIkVlo7m06Vns1l0Rj8BBaMvM ELnOZ4rkiPzT3p18J2bkNy4FsisElzqOGYdb16KNYHYn3LMh2RRA0iOQ2 YiOBRd6YSp2QLRB6dM2q4wpFzuRbhNW1laYnhrfCxbUS8PqV9lyb2KWdu UmnZDpthOvrYifrDG4kIM9xHVHtfruvQBifmljojh2FHuofgqlOP+7VXN OOTFk+wAFvfe1eF0ygaKh5xjmjg6fACSIMi9UTiXyWjN68zmdDSn5MV93 anzfqsWLgUXRzOoAeyLFIqQZrgiTaHfgtpJy7a9ie7ovbN3rY1RQWqQuz A==; X-CSE-ConnectionGUID: TqszR4n2TlSLwmbtNw7Xbw== X-CSE-MsgGUID: OlrN9OUeT7eQ5q1FE/XOrQ== X-IronPort-AV: E=Sophos;i="6.06,206,1705334400"; d="scan'208";a="10855930" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 06 Mar 2024 05:00:56 +0800 IronPort-SDR: Rt9R/jx9dnuzRa/Qt087XNDzD0R+qpyyVtCSjgiNpN0cw4FKITgPiN7vdAmA2B49+NH5FkCibc L1WnhlDP3RNg== Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 05 Mar 2024 12:10:06 -0800 IronPort-SDR: rsMfJvruKGXeOGjuRyl9e64RgoyIPbr5JGMjLJuyvDNdH+2sB3u4GbXLrkLB/6QeNoSFIXQ47J X6e9lYOTia4g== WDCIronportException: Internal Received: from 87h6l33.ad.shared (HELO BXYGM33.ad.shared) ([10.225.32.8]) by uls-op-cesaip01.wdc.com with ESMTP; 05 Mar 2024 13:00:54 -0800 From: Avri Altman To: "James E . J . Bottomley" , "Martin K . Petersen" Cc: Bart Van Assche , Bean Huo , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Avri Altman Subject: [PATCH v2 0/4] Re-use device management code fragments Date: Tue, 5 Mar 2024 23:00:45 +0200 Message-ID: <20240305210051.10847-1-avri.altman@wdc.com> X-Mailer: git-send-email 2.42.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit v1->v2: - Attend Bart's comments Device management commands are constructed for query commands that are being issued by the driver, but also for raw device management commands originated by the bsg module, and recently, by the advanced rpmb handler. Thus, the same code fragments, e.g. locking, composing the command, composing the upiu etc., appear over and over. Remove those duplications. Theoretically, there should be no functional change. Avri Altman (4): scsi: ufs: Re-use device management locking code scsi: ufs: Re-use exec_dev_cmd scsi: ufs: Re-use compose_dev_cmd scsi: ufs: Re-use compose_devman_upiu drivers/ufs/core/ufshcd.c | 204 ++++++++++++++++---------------------- 1 file changed, 86 insertions(+), 118 deletions(-) -- 2.42.0