From patchwork Sun Mar 24 23:54:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 13601135 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 28BF02A6596; Sun, 24 Mar 2024 23:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324600; cv=none; b=rfRaDllB87kums81ubTomwl+lVMpdJpK8rfnHr0uigG0AhG/aSyks/U5GeOEUsJAeZnMV4rtHQz2IgvGmUSytfxq99icFGE1YUx/ADzrcCEiohycx8T1EUfIKNcg0LGw9s1bv9+A5f/lKG+cbC2C2kZQQJviltzSnjzTOZcCK3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711324600; c=relaxed/simple; bh=Xxl7qMT8PZmzWO3kPAFv8o0tXup8Qb3Ysb4NhZCn4Dc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tSC3joZuSaQk/fesNX9FdsLmo/E+Y3qTlQlC5FkRfE2T+2E/XD2/3rmje6Un9DV7I39ZMlmv7OvyGEbMkTDcQ1cMzARXjc8un7siuOnEJpCVmvwInMy65fss2s3gvZ1kUp5CFgQ/thUTvmgPy7vdSPc3KQy8w70bAvGtqGjcjfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de; spf=none smtp.mailfrom=bombadil.srs.infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=VOimJzMd; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bombadil.srs.infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="VOimJzMd" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=gtobFJFBpzQs/ROtgMighh6c3wHyEnqjb/WQx146tTk=; b=VOimJzMdl5OBXqKgxSNMHpxbEI IQTeC+bvBs2S3ST6ZyjYJPMGE/s0Nlrgh9xCa5FyRD1vrJLM/2sGZdF/iLm6xnQlcJN0vpOexr83Z 2zxKpQAvaBVwz1VT14S8EqU8HBBhLUcaQbxyabfZnUOUwsnDvqAQOEMT8JWEaubLgBIfflul2sb+b sp98zt8J3QOCavRSaVDO/OBsaQhhA0fYetjJFPDuChQrkVYK/eQZF9eA6gMWcnG6lKcDdUvWVFSPt ferSCjEOfLnGxZQAwJP/u3oiDwbIFpaXBgfmigKXtso2W/joDRqwX2xW+s89UPFyP5YA6kZXBNFR0 r47pK6wg==; Received: from [210.13.83.2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1roXhV-0000000Dzsa-2yZ9; Sun, 24 Mar 2024 23:56:30 +0000 From: Christoph Hellwig To: Jens Axboe , "Martin K. Petersen" Cc: Damien Le Moal , Niklas Cassel , Takashi Sakamoto , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , "Juergen E. Fischer" , Xiang Chen , HighPoint Linux Team , Tyrel Datwyler , Brian King , Lee Duncan , Chris Leech , Mike Christie , John Garry , Jason Yan , Kashyap Desai , Sumit Saxena , Shivasharan S , Chandrakanth patil , Jack Wang , Nilesh Javali , GR-QLogic-Storage-Upstream@marvell.com, Greg Kroah-Hartman , Alim Akhtar , Avri Altman , Bart Van Assche , Krzysztof Kozlowski , Alan Stern , linux-block@vger.kernel.org, linux-ide@vger.kernel.org, linux1394-devel@lists.sourceforge.net, MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, open-iscsi@googlegroups.com, megaraidlinux.pdl@broadcom.com, mpi3mr-linuxdrv.pdl@broadcom.com, linux-samsung-soc@vger.kernel.org, linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net Subject: [PATCH 22/23] uas: switch to using ->device_configure to configure queue limits Date: Mon, 25 Mar 2024 07:54:47 +0800 Message-Id: <20240324235448.2039074-23-hch@lst.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240324235448.2039074-1-hch@lst.de> References: <20240324235448.2039074-1-hch@lst.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Switch to the ->device_configure method instead of ->slave_alloc and update the block limits on the passed in queue_limits instead of using the per-limit accessors. Note that uas was the only driver setting these size limits from ->slave_alloc and not ->slave_configure and this makes it match everyone else. Signed-off-by: Christoph Hellwig Reviewed-by: Damien Le Moal --- drivers/usb/storage/uas.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/storage/uas.c b/drivers/usb/storage/uas.c index 0668182e1c469c..738c183ccada8d 100644 --- a/drivers/usb/storage/uas.c +++ b/drivers/usb/storage/uas.c @@ -823,19 +823,19 @@ static int uas_slave_alloc(struct scsi_device *sdev) (struct uas_dev_info *)sdev->host->hostdata; sdev->hostdata = devinfo; - - if (devinfo->flags & US_FL_MAX_SECTORS_64) - blk_queue_max_hw_sectors(sdev->request_queue, 64); - else if (devinfo->flags & US_FL_MAX_SECTORS_240) - blk_queue_max_hw_sectors(sdev->request_queue, 240); - return 0; } -static int uas_slave_configure(struct scsi_device *sdev) +static int uas_device_configure(struct scsi_device *sdev, + struct queue_limits *lim) { struct uas_dev_info *devinfo = sdev->hostdata; + if (devinfo->flags & US_FL_MAX_SECTORS_64) + lim->max_hw_sectors = 64; + else if (devinfo->flags & US_FL_MAX_SECTORS_240) + lim->max_hw_sectors = 240; + if (devinfo->flags & US_FL_NO_REPORT_OPCODES) sdev->no_report_opcodes = 1; @@ -900,7 +900,7 @@ static const struct scsi_host_template uas_host_template = { .queuecommand = uas_queuecommand, .target_alloc = uas_target_alloc, .slave_alloc = uas_slave_alloc, - .slave_configure = uas_slave_configure, + .device_configure = uas_device_configure, .eh_abort_handler = uas_eh_abort_handler, .eh_device_reset_handler = uas_eh_device_reset_handler, .this_id = -1,