From patchwork Wed Jul 3 18:44:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 13722704 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 64C42188CD1; Wed, 3 Jul 2024 18:44:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032291; cv=none; b=h6NZhT5O9qCQfcY/OjQDFec2u79rKsBcVEDekXLFs2dE0mOoHfRfXFTrZ6+5iouFDlFqoGRIFuGIIoOHaBRZKffaRAM+hOSV84Ggf7pz4tZgz1fdV3sQkUvBu4V7/EBWYwZTnrsWP9WwyjUm8sAZbISCzOU4w15SmhfmNWGaZig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032291; c=relaxed/simple; bh=S858SQVX9YmHmjvKLTMN0yzpfs0SRvbPJQP2a+vy2SE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sa3EqAdRpSv1ZCAaKynBE0bekGbkS7O2nbZTfyYOlT2EuyuXJL1m32ii33DQjcc/1rhOBl84MkZlnaukGUY4MR4RooI6mC9ohf+7vuTYSCeL9L/970e80IaboFwRoIWx32LpvZjgc3avzoYQF0Wb6rkJVlLYDs+8p/8qKFr9caU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VKHgpQrr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VKHgpQrr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2317DC2BD10; Wed, 3 Jul 2024 18:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720032291; bh=S858SQVX9YmHmjvKLTMN0yzpfs0SRvbPJQP2a+vy2SE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VKHgpQrr1foav0yInaPMFdcQuXS8t2vpYUl/SEgz0+fNRcJT9eIhD3XY7xgRU8Zql lrvVw36pb1hZ4EKC0jeG9jLmpZqLUMDabOBizC3SF7xF96qH/oPs/TxjjF1NbieIcQ a7fQ3g3Un4hyG0GCk5aQQ894MluzcphdZlRPd79Y7rOXI7aKcPvXWHkhUGd34KoaEZ fDWFCbo3lIJkSZSx++NmUtDMTQAHIl3F0t3xBw86VLLuLvdD11FOCGhkQ08rSeB454 uRasiFj5tMRVT5DUPq6oUdfptOiZENs7JcqEHfNPN+GAneOwvNgNjfXdDtBzieCn2+ tVwc9FJIgV2HA== From: Niklas Cassel To: Damien Le Moal , Niklas Cassel , John Garry , Jason Yan , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, Hannes Reinecke , linux-ide@vger.kernel.org Subject: [PATCH v4 1/9] ata,scsi: Remove wrappers ata_sas_tport_{add,delete}() Date: Wed, 3 Jul 2024 20:44:18 +0200 Message-ID: <20240703184418.723066-12-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703184418.723066-11-cassel@kernel.org> References: <20240703184418.723066-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4533; i=cassel@kernel.org; h=from:subject; bh=S858SQVX9YmHmjvKLTMN0yzpfs0SRvbPJQP2a+vy2SE=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJa53B5XFP7tvOmk8vLqd+W33cyPlXv8OVsYmDbBcGN3 EzvTuiad5SyMIhxMciKKbL4/nDZX9ztPuW44h0bmDmsTCBDGLg4BWAibvGMDG2srx7++P728JSq 0J2ZF8VrfV52bJt67/Bsk812S5u2LVZiZFjO8ftv/d63Sx72JOxaJrlzgqI+/9m2edqyH6TvCj+ WdOIHAA== X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA The ata_sas_tport_add() and ata_sas_tport_delete() wrappers only exist in order to export the internal libata functions which they wrap. Remove the wrappers and instead export the libata functions directly. Reviewed-by: Hannes Reinecke Reviewed-by: John Garry Signed-off-by: Niklas Cassel --- drivers/ata/libata-sata.c | 12 ------------ drivers/ata/libata-transport.c | 2 ++ drivers/ata/libata-transport.h | 3 --- drivers/scsi/libsas/sas_ata.c | 2 +- drivers/scsi/libsas/sas_discover.c | 2 +- include/linux/libata.h | 4 ++-- 6 files changed, 6 insertions(+), 19 deletions(-) diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 9e047bf912b1..e7991595bfe5 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -1241,18 +1241,6 @@ struct ata_port *ata_sas_port_alloc(struct ata_host *host, } EXPORT_SYMBOL_GPL(ata_sas_port_alloc); -int ata_sas_tport_add(struct device *parent, struct ata_port *ap) -{ - return ata_tport_add(parent, ap); -} -EXPORT_SYMBOL_GPL(ata_sas_tport_add); - -void ata_sas_tport_delete(struct ata_port *ap) -{ - ata_tport_delete(ap); -} -EXPORT_SYMBOL_GPL(ata_sas_tport_delete); - /** * ata_sas_device_configure - Default device_configure routine for libata * devices diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c index 3e49a877500e..d24f201c0ab2 100644 --- a/drivers/ata/libata-transport.c +++ b/drivers/ata/libata-transport.c @@ -265,6 +265,7 @@ void ata_tport_delete(struct ata_port *ap) transport_destroy_device(dev); put_device(dev); } +EXPORT_SYMBOL_GPL(ata_tport_delete); static const struct device_type ata_port_sas_type = { .name = ATA_PORT_TYPE_NAME, @@ -329,6 +330,7 @@ int ata_tport_add(struct device *parent, put_device(dev); return error; } +EXPORT_SYMBOL_GPL(ata_tport_add); /** * ata_port_classify - determine device type based on ATA-spec signature diff --git a/drivers/ata/libata-transport.h b/drivers/ata/libata-transport.h index 08a57fb9dc61..50cd2cbe8eea 100644 --- a/drivers/ata/libata-transport.h +++ b/drivers/ata/libata-transport.h @@ -8,9 +8,6 @@ extern struct scsi_transport_template *ata_scsi_transport_template; int ata_tlink_add(struct ata_link *link); void ata_tlink_delete(struct ata_link *link); -int ata_tport_add(struct device *parent, struct ata_port *ap); -void ata_tport_delete(struct ata_port *ap); - struct scsi_transport_template *ata_attach_transport(void); void ata_release_transport(struct scsi_transport_template *t); diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index cbbe43d8ef87..ab4ddeea4909 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -608,7 +608,7 @@ int sas_ata_init(struct domain_device *found_dev) ap->cbl = ATA_CBL_SATA; ap->scsi_host = shost; - rc = ata_sas_tport_add(ata_host->dev, ap); + rc = ata_tport_add(ata_host->dev, ap); if (rc) goto free_port; diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index 48d975c6dbf2..951bdc554a10 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c @@ -300,7 +300,7 @@ void sas_free_device(struct kref *kref) kfree(dev->ex_dev.ex_phy); if (dev_is_sata(dev) && dev->sata_dev.ap) { - ata_sas_tport_delete(dev->sata_dev.ap); + ata_tport_delete(dev->sata_dev.ap); ata_port_free(dev->sata_dev.ap); ata_host_put(dev->sata_dev.ata_host); dev->sata_dev.ata_host = NULL; diff --git a/include/linux/libata.h b/include/linux/libata.h index 7d3bd7c9664a..586f0116d1d7 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1250,8 +1250,8 @@ extern struct ata_port *ata_sas_port_alloc(struct ata_host *, struct ata_port_info *, struct Scsi_Host *); extern void ata_port_probe(struct ata_port *ap); extern void ata_port_free(struct ata_port *ap); -extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap); -extern void ata_sas_tport_delete(struct ata_port *ap); +extern int ata_tport_add(struct device *parent, struct ata_port *ap); +extern void ata_tport_delete(struct ata_port *ap); int ata_sas_device_configure(struct scsi_device *sdev, struct queue_limits *lim, struct ata_port *ap); extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap); From patchwork Wed Jul 3 18:44:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 13722705 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7ACA5188CD1; Wed, 3 Jul 2024 18:44:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032294; cv=none; b=hczDMop4awKoqC+oklgbE5YnWoji1fAg89/FzGlpE4agZSKJfiGosfxT0vrx/CElzRZA+WT8nBS/znRJZzWKFYpZeM5YzZoZrY8tjAz4FWTn0sce8TFdwcbNylPpDgdYt0A5Eb1QjauxzPdEwU7iSy2U8uS+N2gHhBIXWhLA6sE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032294; c=relaxed/simple; bh=gPbInyMbE7OFPzXDVK+ChS+iQcVWiyhWogsVEQ4IImk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CK37SOUDMmTvKaAY88UxTVjEh1tbV5hDphg7EWAdGRUuNtePYmpp7cx4RENqjhOIeKlG1jPQGOA76Kf5x6hZo05K8o1B09yfMrh+yLhTfCruzAxbw+rk04dJTqajnqly64bV7Fb0XtMaEw/BksnsTi4WvhR1W4JcvsUm+kRVU5g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uzlFBa/5; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uzlFBa/5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5ECCC4AF07; Wed, 3 Jul 2024 18:44:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720032294; bh=gPbInyMbE7OFPzXDVK+ChS+iQcVWiyhWogsVEQ4IImk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uzlFBa/52O37fMp/Dph/twoIY1g2HstcpRFYMM3cnr/XM5PQppmKhMPWCXsxhI5Rl AN/lKBC5ZoUIb6gpWVRpbUHumL6PcxTEuxch7gi/RaL2u7rdDCc+tlAmVQHwAArjfp Ddu4aA2JGPw/QvGUBY06Gwzi0yrEEaILy1/RmEo9G8mLd0QHvq4svLt3x438ibiQNl OFv+PzdcZOfEpbb/TJfECbmQPB8e58kRJhDQ/4iSKYjTmeHle7mk2rQEOP9ug0Q75X n39xCHEbhVDGAbn7NjMleLvCtLtVDbsdgkkyCnalRh3xpUAV94r2EM7MBOXTUporXJ CC19mfM7v20Jw== From: Niklas Cassel To: Damien Le Moal , Niklas Cassel Cc: linux-scsi@vger.kernel.org, John Garry , Jason Yan , "Martin K. Petersen" , "James E.J. Bottomley" , Hannes Reinecke , linux-ide@vger.kernel.org Subject: [PATCH v4 2/9] ata: libata: Remove unused function declaration for ata_scsi_detect() Date: Wed, 3 Jul 2024 20:44:19 +0200 Message-ID: <20240703184418.723066-13-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703184418.723066-11-cassel@kernel.org> References: <20240703184418.723066-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=916; i=cassel@kernel.org; h=from:subject; bh=gPbInyMbE7OFPzXDVK+ChS+iQcVWiyhWogsVEQ4IImk=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJa53Dvr5T1kNRUMLewzM0Tm3iFY87yN/d19N9d2irx9 gl/yXL7jlIWBjEuBlkxRRbfHy77i7vdpxxXvGMDM4eVCWQIAxenAEzkrisjw3T2HOEa6eildmes HZd+8nuzI1+B18u0zHftecNfcjnNrxn+WbetFLZk1V9UfUg8cQub9IR7uVrnTi9rXWQale9c33q HBwA= X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA Remove unused function declaration for ata_scsi_detect(). Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Signed-off-by: Niklas Cassel --- include/linux/libata.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/libata.h b/include/linux/libata.h index 586f0116d1d7..580971e11804 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1082,7 +1082,6 @@ extern int ata_host_activate(struct ata_host *host, int irq, const struct scsi_host_template *sht); extern void ata_host_detach(struct ata_host *host); extern void ata_host_init(struct ata_host *, struct device *, struct ata_port_operations *); -extern int ata_scsi_detect(struct scsi_host_template *sht); extern int ata_scsi_ioctl(struct scsi_device *dev, unsigned int cmd, void __user *arg); #ifdef CONFIG_COMPAT From patchwork Wed Jul 3 18:44:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 13722706 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2A4D5187570; Wed, 3 Jul 2024 18:44:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032297; cv=none; b=BEdeGf90WXDJ08rnpRzi/o23xFj7NlSKgusCO/FpjGpT/rOUcAMyamJicXLgVrSDkCxTdYxtZeZHkrURg5uLTCvQLl88TuBHvmBlQquwwfEmkqlsWH21RDWaRNo0fWa7Ca4ggz6uDNqS8BrYxlDdxV3WggUNQGGTfhro8ZpUHDk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032297; c=relaxed/simple; bh=uL3qsxejMXbViNaxr/B+wibPmddp21cvRX8gRv8J9dU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rFQYVr7fr4qRPgvgEPU2d0Y4yyFi2P1Q6fsVKKvcLYGvwGQ+cUqsR1hM/loSNCRQLaUsC9niaIDDWUm443IJ/925YDvQWRgFKOF5vS1LDr1jlQCsmKkOiQmQcYiaxECiRw4CvnMlTnfWFmkktZxZSpNc5vS9J8EIVe6jidWPosw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z9FBMKlD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z9FBMKlD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE785C4AF07; Wed, 3 Jul 2024 18:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720032296; bh=uL3qsxejMXbViNaxr/B+wibPmddp21cvRX8gRv8J9dU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z9FBMKlDwxpopaf/pQY/nQJfGGuCXEe/T0ktV4R3Kr9+VF1Blz503gQ7/eWnbNnx1 iz/dAcoWcjteAIzW3gzTGmy4WVXVTuiQxqbWDiHuw9Hiv9e0J+dro7sp8tsPQlXbjt AyXTjw+y1w0EW685RGUzRSz2iz5rZIYXmCMBUXBsGaZfW20DoNMwIPHwX4kYtwnYJs LHcoIRd7Kt2a175E/Pm4TeJ9QstFgXYvCe+9ctEejbmOoC1dqFFpyx2uzajMQTOL4R uzvZ2ffbguZG7Ocw/Lx4wELyMLonK+werzqkMdSIGDKfk7dfziDenuZTh79MMzyjZh wXSadPYXJtpww== From: Niklas Cassel To: Damien Le Moal , Niklas Cassel Cc: linux-scsi@vger.kernel.org, John Garry , Jason Yan , "Martin K. Petersen" , "James E.J. Bottomley" , linux-ide@vger.kernel.org Subject: [PATCH v4 3/9] ata: libata-core: Remove support for decreasing the number of ports Date: Wed, 3 Jul 2024 20:44:20 +0200 Message-ID: <20240703184418.723066-14-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703184418.723066-11-cassel@kernel.org> References: <20240703184418.723066-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4372; i=cassel@kernel.org; h=from:subject; bh=uL3qsxejMXbViNaxr/B+wibPmddp21cvRX8gRv8J9dU=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJa53BvcDPZ4m/CsWDT1cOne7RmfL0+9ZBX19YnJbb3a 54r6TaWdZSyMIhxMciKKbL4/nDZX9ztPuW44h0bmDmsTCBDGLg4BWAiBtoM/1OZrzBXpxXs9X0g 8XTvlvjnLx5H/Z1c1Payc8vSMy1tTiqMDF99LzyTfVa65sYm2ZDdB7dpzPDe66wa/oTfLtmwa9Z XJ2YA X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA Commit f31871951b38 ("libata: separate out ata_host_alloc() and ata_host_register()") added ata_host_alloc(), where the API allowed a LLD to overallocate the number of ports supplied to ata_host_alloc(), as long as the LLD decreased host->n_ports before calling ata_host_register(). However, this functionally has never ever been used by a single LLD. Because of the current API design, the assignment of ap->print_id is deferred until registration time, which is bad, because that means that the ata_port_*() print functions cannot be used by a LLD until after registration time, which means that a LLD is forced to use a print function that is non-port specific, even for a port specific error. Remove the support for decreasing the number of ports, such that it will be possible to assign ap->print_id earlier. Reviewed-by: Damien Le Moal Signed-off-by: Niklas Cassel --- drivers/ata/libata-core.c | 22 +++++----------------- include/linux/libata.h | 2 +- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 74b59b78d278..f0cce3fec902 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5547,24 +5547,19 @@ EXPORT_SYMBOL_GPL(ata_host_put); /** * ata_host_alloc - allocate and init basic ATA host resources * @dev: generic device this host is associated with - * @max_ports: maximum number of ATA ports associated with this host + * @n_ports: the number of ATA ports associated with this host * * Allocate and initialize basic ATA host resources. LLD calls * this function to allocate a host, initializes it fully and * attaches it using ata_host_register(). * - * @max_ports ports are allocated and host->n_ports is - * initialized to @max_ports. The caller is allowed to decrease - * host->n_ports before calling ata_host_register(). The unused - * ports will be automatically freed on registration. - * * RETURNS: * Allocate ATA host on success, NULL on failure. * * LOCKING: * Inherited from calling layer (may sleep). */ -struct ata_host *ata_host_alloc(struct device *dev, int max_ports) +struct ata_host *ata_host_alloc(struct device *dev, int n_ports) { struct ata_host *host; size_t sz; @@ -5572,7 +5567,7 @@ struct ata_host *ata_host_alloc(struct device *dev, int max_ports) void *dr; /* alloc a container for our list of ATA ports (buses) */ - sz = sizeof(struct ata_host) + (max_ports + 1) * sizeof(void *); + sz = sizeof(struct ata_host) + n_ports * sizeof(void *); host = kzalloc(sz, GFP_KERNEL); if (!host) return NULL; @@ -5592,11 +5587,11 @@ struct ata_host *ata_host_alloc(struct device *dev, int max_ports) spin_lock_init(&host->lock); mutex_init(&host->eh_mutex); host->dev = dev; - host->n_ports = max_ports; + host->n_ports = n_ports; kref_init(&host->kref); /* allocate ports bound to this host */ - for (i = 0; i < max_ports; i++) { + for (i = 0; i < n_ports; i++) { struct ata_port *ap; ap = ata_port_alloc(host); @@ -5905,13 +5900,6 @@ int ata_host_register(struct ata_host *host, const struct scsi_host_template *sh return -EINVAL; } - /* Blow away unused ports. This happens when LLD can't - * determine the exact number of ports to allocate at - * allocation time. - */ - for (i = host->n_ports; host->ports[i]; i++) - ata_port_free(host->ports[i]); - /* give ports names and add SCSI hosts */ for (i = 0; i < host->n_ports; i++) { host->ports[i]->print_id = atomic_inc_return(&ata_print_id); diff --git a/include/linux/libata.h b/include/linux/libata.h index 580971e11804..b7c5d3f33368 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1069,7 +1069,7 @@ extern int sata_std_hardreset(struct ata_link *link, unsigned int *class, unsigned long deadline); extern void ata_std_postreset(struct ata_link *link, unsigned int *classes); -extern struct ata_host *ata_host_alloc(struct device *dev, int max_ports); +extern struct ata_host *ata_host_alloc(struct device *dev, int n_ports); extern struct ata_host *ata_host_alloc_pinfo(struct device *dev, const struct ata_port_info * const * ppi, int n_ports); extern void ata_host_get(struct ata_host *host); From patchwork Wed Jul 3 18:44:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 13722707 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 F30111DA313; Wed, 3 Jul 2024 18:44:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032300; cv=none; b=ENGlo+Dlz1GHTrkVllZw6Hs/rOW6Qmoa3U2VkBk0LGoQ3N8nVtNdwaYiRzSd8/iXvc2Gfq7nerKSMO7aZtxdbE8Sfb85oj55Nvhy5DUT6m49IBqXFQEBOXoL9FAhUANmpLDTPLLvdiffh8TU4zUAh3NxYcqbBJOiRBqRykcy43c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032300; c=relaxed/simple; bh=pJFjRC4pdUovu49pfV86X1dvnSXZmQTs5FtES/N36iQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IguhSQAV7ZIhmWxCFX1RpelqGbVXtV0ZAad7HFXyRsHJRLBCeSg8dz0uvfDU924RI0bE6yzOCn+lptxigfuE+RsXWtGVr9USZ0WtgbT7prcBNYoDh8fb6rKJUdYeyAa4F3OLYea2/raB2ZzJvu8zxP2IopHDtD2C+BYiLYDNMaQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jU+kF2F+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jU+kF2F+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 718DFC4AF07; Wed, 3 Jul 2024 18:44:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720032299; bh=pJFjRC4pdUovu49pfV86X1dvnSXZmQTs5FtES/N36iQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jU+kF2F+1IRMPGdcEL5pvYTKRYOLB+TDnOSTZghMDIqdzaZ8ebyCdpXqScTBwhxhu 3viSVIsr8YTtAyjkl6NCUd14uQOCkMgN4tSOSuCw4y0vyIAhD4ZRdfHtJ6tOkHTQUl e1q/EEB6ywzOm+6+sirtxaGE2oTYxT2OabLxgvt18bzdYAtxB+PNS7938ktEeN3iwc UEWaDPeeuEck6YKjj5CmbcLSUm/a0fyIDBk80HmDb6MxVCaECc7sCzQIP+9/vefhCj lLYwfF0jZgIvwzX2PY3oT+9sPVTc0SE3nGHJCDoNQxUOKNJqXtbSBB+6mC5bnJeIjo YQj+QD9XnSUYw== From: Niklas Cassel To: Damien Le Moal , Niklas Cassel Cc: linux-scsi@vger.kernel.org, John Garry , Jason Yan , "Martin K. Petersen" , "James E.J. Bottomley" , Hannes Reinecke , linux-ide@vger.kernel.org Subject: [PATCH v4 4/9] ata: libata-sata: Remove superfluous assignment in ata_sas_port_alloc() Date: Wed, 3 Jul 2024 20:44:21 +0200 Message-ID: <20240703184418.723066-15-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703184418.723066-11-cassel@kernel.org> References: <20240703184418.723066-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=822; i=cassel@kernel.org; h=from:subject; bh=pJFjRC4pdUovu49pfV86X1dvnSXZmQTs5FtES/N36iQ=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJa53BzF9luvqZuwtOyNWcui829BO7Z67Zk9PyYxTalO YXnJdfCjlIWBjEuBlkxRRbfHy77i7vdpxxXvGMDM4eVCWQIAxenAExEMoGR4XtPdFqsRWu484F2 warcxHOn3j/0NK1ceX5lffKD1QE+HowMV4v5ctfv/Ve6V/hT+HxVxnrJ+4/bGR1b98k+8+QL7hT lAAA= X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA ata_sas_port_alloc() calls ata_port_alloc() which already assigns ap->lock so there is no need for ata_sas_port_alloc() to assign it again. Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Signed-off-by: Niklas Cassel --- drivers/ata/libata-sata.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index e7991595bfe5..1a36a5d1d7bc 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -1228,7 +1228,6 @@ struct ata_port *ata_sas_port_alloc(struct ata_host *host, return NULL; ap->port_no = 0; - ap->lock = &host->lock; ap->pio_mask = port_info->pio_mask; ap->mwdma_mask = port_info->mwdma_mask; ap->udma_mask = port_info->udma_mask; From patchwork Wed Jul 3 18:44:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 13722708 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 F28EF18C341; Wed, 3 Jul 2024 18:45:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032303; cv=none; b=VwbK3CLaMg+u6GBXsvJNb30p7morN9Ik5jF4uVubPmbTWLOOVLbskJCJOGOmKLAIksgpG5Zrvp9p9BlFNZF6VRPojQevOpA2V47T1ZklWK+jNewLfvxbvbOXRAy5tfYvgpBGBpwLJ8/RdmBdPLd+kF1ThZXOv9WlDgUyX9AEAkE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032303; c=relaxed/simple; bh=rGLhGA4U0nWfnf9gDicbn5UReSpLOrwyOSqv92NlJnE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jmr9rMQswKdQmS8azLrLLdy52QPHA2nwjGDyrE47glfmFGdcUJAiX7T1Su3qkOXlXqjoYll/Rq3xDp49y5qkxLcbqqdYi/bQGdbxA/E7rMpVSPNbk6B2w7VCZP+qWr6XQURBkrrDMijzFBC4egPpJSY6/V1st7sES3ClJitDYe4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CvyJTmWW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CvyJTmWW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77FBAC4AF07; Wed, 3 Jul 2024 18:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720032302; bh=rGLhGA4U0nWfnf9gDicbn5UReSpLOrwyOSqv92NlJnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CvyJTmWW/C/JFYTx0qdl9Ze1XXaHY1XgxkHAEAQbHsMaamUjhkTtu9V3qD8tH/hO2 Sh5EgCs+RvSzFrbSznjz7pjUf+mz7x8tisHsgmiOaHzDlAAOk4Y1xcaOLra2o8m58S 5/o31wIP7d70OSyu3xCOnVKxhoWKidceTXeYy3qQWrquHM0MB6dS6r+jKNh7JLy9h3 5wlX/6EZUimc8h4jpu9JdhU5CUISbXJuVfO3qQLkim1wcP0qXCYwbWzsBP0zSXlx6l jibAXIwfvggXd0N/yaQ+D8iVONd7WNlBpI6tyrU1iHre+HVeFY51t9h5H/630wb/6w Sn+3ojEdPmMwA== From: Niklas Cassel To: Damien Le Moal , Niklas Cassel Cc: linux-scsi@vger.kernel.org, John Garry , Jason Yan , "Martin K. Petersen" , "James E.J. Bottomley" , Hannes Reinecke , linux-ide@vger.kernel.org Subject: [PATCH v4 5/9] ata: libata-core: Remove local_port_no struct member Date: Wed, 3 Jul 2024 20:44:22 +0200 Message-ID: <20240703184418.723066-16-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703184418.723066-11-cassel@kernel.org> References: <20240703184418.723066-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2682; i=cassel@kernel.org; h=from:subject; bh=rGLhGA4U0nWfnf9gDicbn5UReSpLOrwyOSqv92NlJnE=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJa5/B4K4YIMp75ps23qeykqlxF8cR1zyJD+IxFWJXbJ qTWnM7oKGVhEONikBVTZPH94bK/uNt9ynHFOzYwc1iZQIYwcHEKwEQuOzD8d+wXvfP7TOe5Lxem Zz/y1svlSJ+k2v75yO7TWroF3d1O1xkZXmvoeRtL239Mv7zwweobC6VmZxw/7u6btuWMcOTsZw1 bOQE= X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA ap->local_port_no is simply ap->port_no + 1. Since ap->local_port_no can be derived from ap->port_no, there is no need for the ap->local_port_no struct member, so remove ap->local_port_no. Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Signed-off-by: Niklas Cassel --- drivers/ata/libata-core.c | 5 +---- drivers/ata/libata-transport.c | 3 ++- include/linux/libata.h | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index f0cce3fec902..aff54651da65 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5463,7 +5463,6 @@ struct ata_port *ata_port_alloc(struct ata_host *host) ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN; ap->lock = &host->lock; ap->print_id = -1; - ap->local_port_no = -1; ap->host = host; ap->dev = host->dev; @@ -5901,10 +5900,8 @@ int ata_host_register(struct ata_host *host, const struct scsi_host_template *sh } /* give ports names and add SCSI hosts */ - for (i = 0; i < host->n_ports; i++) { + for (i = 0; i < host->n_ports; i++) host->ports[i]->print_id = atomic_inc_return(&ata_print_id); - host->ports[i]->local_port_no = i + 1; - } /* Create associated sysfs transport objects */ for (i = 0; i < host->n_ports; i++) { diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c index d24f201c0ab2..9e24c33388f9 100644 --- a/drivers/ata/libata-transport.c +++ b/drivers/ata/libata-transport.c @@ -217,7 +217,8 @@ static DEVICE_ATTR(name, S_IRUGO, show_ata_port_##name, NULL) ata_port_simple_attr(nr_pmp_links, nr_pmp_links, "%d\n", int); ata_port_simple_attr(stats.idle_irq, idle_irq, "%ld\n", unsigned long); -ata_port_simple_attr(local_port_no, port_no, "%u\n", unsigned int); +/* We want the port_no sysfs attibute to start at 1 (ap->port_no starts at 0) */ +ata_port_simple_attr(port_no + 1, port_no, "%u\n", unsigned int); static DECLARE_TRANSPORT_CLASS(ata_port_class, "ata_port", NULL, NULL, NULL); diff --git a/include/linux/libata.h b/include/linux/libata.h index b7c5d3f33368..84a7bfbac9fa 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -814,7 +814,6 @@ struct ata_port { /* Flags that change dynamically, protected by ap->lock */ unsigned int pflags; /* ATA_PFLAG_xxx */ unsigned int print_id; /* user visible unique port ID */ - unsigned int local_port_no; /* host local port num */ unsigned int port_no; /* 0 based port no. inside the host */ #ifdef CONFIG_ATA_SFF From patchwork Wed Jul 3 18:44:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 13722709 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B25B4187353; Wed, 3 Jul 2024 18:45:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032305; cv=none; b=Xyfh6r5qs/SwR4O53AvP8z90Wxrm4Rc0ofDRI03ZuFU+nv/xi0vyhWx7Ef7HchyQu10tzxld4r5OxSwPj5WhGiApUZ2fsF6G6vMy60VoNBbeOPcNSO670Btazas6M7s2cF920CxD65X8PACKWZBpzjEARZErRUw2Kf2vZAN2VfQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032305; c=relaxed/simple; bh=tbDAh0q0cfWpxkoy8wWkLTXEdVgFDHunVlxbO8TdVRc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dIxstcm5zUJj4PJb5Ac7PqX79/jQAIvAoFxHPObXwQKQ0W92E0vH4KW+4RvC94xXGu/GwnfalArPI7kQdSTuR6B8kjZTeZwzDcjinFnAiVDxvEvgRZMXt8KRxNzAfoafJPC1SUtkqYHQ7giGceAFNFHTcUcIo+tac4JBRBjA+T0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tnwCGZ4l; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tnwCGZ4l" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71909C4AF0C; Wed, 3 Jul 2024 18:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720032305; bh=tbDAh0q0cfWpxkoy8wWkLTXEdVgFDHunVlxbO8TdVRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tnwCGZ4lWpo2B7gIjv9hVSDm4u5Y3OS+1iUUGg3NEhIHTwooTIZciyBaR8i/QPw1o ybYL84akOdNEJ87Ril7YZ+4N11VPcLG4wDowOmLlpRLRMK1KmZ7D7+Ll0neU5ytQMB D/5r2GOk+OXRWjFOwBjHAtoI0mYocV+bjKyLPfP4Q+wMBIKwiCTge5ftNhcqRry8Et IbsSmKDroY+JlQKdZvxKsY+iswj9Fa54foS43RPvJ77MXHjjQlL+VvFHZggQpA88xq hnSIK6O4SNJhQOAhVW94Qql70sV58dvYZGsmiAK0cWIcTTswZiCnnYGXn04YS2Wi/v v9KvqazhCQcCw== From: Niklas Cassel To: Damien Le Moal , Niklas Cassel Cc: linux-scsi@vger.kernel.org, John Garry , Jason Yan , "Martin K. Petersen" , "James E.J. Bottomley" , Hannes Reinecke , linux-ide@vger.kernel.org Subject: [PATCH v4 6/9] ata: libata: Assign print_id at port allocation time Date: Wed, 3 Jul 2024 20:44:23 +0200 Message-ID: <20240703184418.723066-17-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703184418.723066-11-cassel@kernel.org> References: <20240703184418.723066-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2459; i=cassel@kernel.org; h=from:subject; bh=tbDAh0q0cfWpxkoy8wWkLTXEdVgFDHunVlxbO8TdVRc=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJa5/BoVff5f5S4a+zoXMXqvy/G2JX1s2h3f8yb0nn8p me7Tot3lLIwiHExyIopsvj+cNlf3O0+5bjiHRuYOaxMIEMYuDgFYCLp2gy/WTxN9ijduuUpt2Dy wo99djk/tx+fsmFLSeJNp1sXrmh/Fmdk2BnWoaJgMTWK+fDKwy5yMW27O02jYtoO8HAGKmRV14Z xAQA= X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA While the assignment of ap->print_id could have been moved to ata_host_alloc(), let's simply move it to ata_port_alloc(). If you allocate a port, you want to give it a unique name that can be used for printing. By moving the ap->print_id assignment to ata_port_alloc(), means that we can also remove the ap->print_id assignment from ata_sas_port_alloc(). This will allow a LLD to use the ata_port_*() print functions before ata_host_register() has been called. Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Signed-off-by: Niklas Cassel --- drivers/ata/libata-core.c | 6 +----- drivers/ata/libata-sata.c | 1 - drivers/ata/libata.h | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index aff54651da65..f02c023ba89e 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5462,7 +5462,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host) ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN; ap->lock = &host->lock; - ap->print_id = -1; + ap->print_id = atomic_inc_return(&ata_print_id); ap->host = host; ap->dev = host->dev; @@ -5899,10 +5899,6 @@ int ata_host_register(struct ata_host *host, const struct scsi_host_template *sh return -EINVAL; } - /* give ports names and add SCSI hosts */ - for (i = 0; i < host->n_ports; i++) - host->ports[i]->print_id = atomic_inc_return(&ata_print_id); - /* Create associated sysfs transport objects */ for (i = 0; i < host->n_ports; i++) { rc = ata_tport_add(host->dev,host->ports[i]); diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 1a36a5d1d7bc..b602247604dc 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -1234,7 +1234,6 @@ struct ata_port *ata_sas_port_alloc(struct ata_host *host, ap->flags |= port_info->flags; ap->ops = port_info->port_ops; ap->cbl = ATA_CBL_SATA; - ap->print_id = atomic_inc_return(&ata_print_id); return ap; } diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 38ce13b55474..5ea194ae8a8b 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h @@ -32,7 +32,6 @@ enum { #define ATA_PORT_TYPE_NAME "ata_port" -extern atomic_t ata_print_id; extern int atapi_passthru16; extern int libata_fua; extern int libata_noacpi; From patchwork Wed Jul 3 18:44:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 13722710 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BFA46187353; Wed, 3 Jul 2024 18:45:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032308; cv=none; b=LLsL8thhjLu5LvaPxdj5tiGU+P4W11GuSfETD/wMlmL7bXaDbocWJJW9zMQYHVyJAc/JL+gP/vOei4v+tL0tHHSNpwKyKZbe4ywoI9+cg+tVmuuBjgcT+lvOaMc50jzuwYgzZm5v+UNjkZ4Kj9xav84Jy545Wb3NQndUGCAI3Fw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032308; c=relaxed/simple; bh=X7mlgOE0kf+ALAuEbjybN4/crwHxq36D50SYzF6JoYI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b+mw8ybQXcaGx0bI0O+P2GTC8s1y0G6gworubQwGBpJecPRsJYVge6i0sANJBCTMDL5YnblRYrpOZPBYd97FxkiMLv9ZGepntpo8besy+HEX7SR9yHZcnq3YF9lskudQ4Y5I5mrwQk1inM2pWAWxCwwkU9iM/wsf4eePjfbVF+E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gK9C9Mys; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gK9C9Mys" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FED4C32781; Wed, 3 Jul 2024 18:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720032308; bh=X7mlgOE0kf+ALAuEbjybN4/crwHxq36D50SYzF6JoYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gK9C9MysN2jQZ+t/oTFlM7FmP69BVZe4OcYbFitVltbz1WMsITeakufLzs2UKXMz3 hdiD/8U3tCxPgpmXRoYx1d2GJACRXxJ5bPxamOHp3SJW6SZ0yoHdl2rpS65/hldNML c2vSMSxNY9ztqrp/1xVpqqMaUzLzqC1L0vnAn8pwexf8EJSn6Q5Um5QNP0mVTNCdQp ujJuGE56DJVsxWOLIHx5afW6F0DRvBHZhnpp9df2QcoG5tOdl/13HOvN8eqA9RtO3D DVI4dGoLYDP6U8TjvHj+BPdISBaBaTproqDtYhMGQfvLgr5LoejN71iUeYRVYkf46Y b/i3nru0RE54g== From: Niklas Cassel To: Damien Le Moal , Niklas Cassel Cc: linux-scsi@vger.kernel.org, John Garry , Jason Yan , "Martin K. Petersen" , "James E.J. Bottomley" , Hannes Reinecke , linux-ide@vger.kernel.org Subject: [PATCH v4 7/9] ata: libata-core: Reuse available ata_port print_ids Date: Wed, 3 Jul 2024 20:44:24 +0200 Message-ID: <20240703184418.723066-18-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703184418.723066-11-cassel@kernel.org> References: <20240703184418.723066-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2031; i=cassel@kernel.org; h=from:subject; bh=X7mlgOE0kf+ALAuEbjybN4/crwHxq36D50SYzF6JoYI=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJa5/D+8Jn05USTZZ7dnXfJzaHXdZ4xqpRvWStflPp0y kK7ibszO0pZGMS4GGTFFFl8f7jsL+52n3Jc8Y4NzBxWJpAhDFycAjARxdUM/5S2L3J7nN9l+PKi k53Q9LYFXQUn+27UOH+Y6BZy7xLfRitGho6CbMvc7LVvvrLdqAgTCYw4wK2Tf9+0iD8jufx41Eo pZgA= X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA Currently, the ata_port print_ids are increased indefinitely, even when there are lower ids available. E.g. on first boot you will have ata1-ata6 assigned. After a rmmod + modprobe, you will instead have ata7-ata12 assigned. Move to use the ida_alloc() API, such that print_ids will get reused. This means that even after a rmmod + modprobe, the ports will be assigned print_ids ata1-ata6. Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Signed-off-by: Niklas Cassel --- drivers/ata/libata-core.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index f02c023ba89e..5031064834be 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -86,7 +86,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev); static void ata_dev_xfermask(struct ata_device *dev); static unsigned long ata_dev_blacklisted(const struct ata_device *dev); -atomic_t ata_print_id = ATOMIC_INIT(0); +static DEFINE_IDA(ata_ida); #ifdef CONFIG_ATA_FORCE struct ata_force_param { @@ -5455,6 +5455,7 @@ int sata_link_init_spd(struct ata_link *link) struct ata_port *ata_port_alloc(struct ata_host *host) { struct ata_port *ap; + int id; ap = kzalloc(sizeof(*ap), GFP_KERNEL); if (!ap) @@ -5462,7 +5463,12 @@ struct ata_port *ata_port_alloc(struct ata_host *host) ap->pflags |= ATA_PFLAG_INITIALIZING | ATA_PFLAG_FROZEN; ap->lock = &host->lock; - ap->print_id = atomic_inc_return(&ata_print_id); + id = ida_alloc_min(&ata_ida, 1, GFP_KERNEL); + if (id < 0) { + kfree(ap); + return NULL; + } + ap->print_id = id; ap->host = host; ap->dev = host->dev; @@ -5496,6 +5502,7 @@ void ata_port_free(struct ata_port *ap) kfree(ap->pmp_link); kfree(ap->slave_link); kfree(ap->ncq_sense_buf); + ida_free(&ata_ida, ap->print_id); kfree(ap); } EXPORT_SYMBOL_GPL(ata_port_free); From patchwork Wed Jul 3 18:44:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 13722711 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0308317A5B0; Wed, 3 Jul 2024 18:45:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032312; cv=none; b=kpcdlHXDYL7ed7bOSOzjd0w8njxeHkvelJLEXccfDM5vjlPJ6ly5LGqjOfbvK0KxdRgmAo4V4f9pXUsL5H6luss/+W4pZRq5ZMdGsvBWUxK1PcXmVuT01SZanGTRhFZz9bxVNmME2gDGrcS7eetripsMT6PDLYTNGM8WEg/22gc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032312; c=relaxed/simple; bh=/MLKSt9L9K9TbHwrbZnMJA+gn6m1M/anrGf/UAzP/OQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T/LHlmGxPT3bB8zGNehkwCxxtyK+IlLeXgCoi9X4UfrcNpAmrU8l6LNMch35ii8JQ0a65kj/rjvMKqIf2rnsUW1T95DbXRPW3Ru0p6ajt8W8sI8+8WD7L7C0kslGOwQmjulvkZNc+e2oPyDCEvQxlGWOD6f7NowgEBABiL7pJ80= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uCvROagr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uCvROagr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77515C2BD10; Wed, 3 Jul 2024 18:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720032311; bh=/MLKSt9L9K9TbHwrbZnMJA+gn6m1M/anrGf/UAzP/OQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uCvROagrDbtC711sGGijz7Qcti6AsgKTf2cMEkmebCU49J77JLmfkmi4TXUUcLT+A 3c8ZtZS63JSbVWiXv1/xDzlnpZ4rtkQepxkY8t6SrF/UFewCKyJtht/Q3eVwMvqtLF z81lYAshkb9/IZsh37/yjTkXbuIiM/u45lqVNOBHft6lt3NzJr0LJ0Ahs6BqOCFP+0 Js4wmEIKzz2qIyFZB7y+WYWo/IXdi8VfqtKnG4A2Rew5qhHaXNHIImudr8jYfxdoyt veV9RFkH2xHQ0xiPr3CAGoPXkxwC9NcAXWpBUhpGhrCyiJ4K5Oq/oVvB7M7IgmqiLI tYJ3xrb9gPkXQ== From: Niklas Cassel To: Damien Le Moal , Niklas Cassel , John Garry , Jason Yan , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, Hannes Reinecke , linux-ide@vger.kernel.org Subject: [PATCH v4 8/9] ata,scsi: Remove wrapper ata_sas_port_alloc() Date: Wed, 3 Jul 2024 20:44:25 +0200 Message-ID: <20240703184418.723066-19-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703184418.723066-11-cassel@kernel.org> References: <20240703184418.723066-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5664; i=cassel@kernel.org; h=from:subject; bh=/MLKSt9L9K9TbHwrbZnMJA+gn6m1M/anrGf/UAzP/OQ=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJa5/DqNp5h5ns3Z2cZt4nTfZPpz2+56pa8uVF93L6NT ++rF+P9jlIWBjEuBlkxRRbfHy77i7vdpxxXvGMDM4eVCWQIAxenAEwks4OR4aqtaVeIjrBld5nT qn9Xq3Y03DMve9bIu1+D75t23KUOMUaG5XtZgq0rRBaql6UGRQs3pPEePejxX+c/f4Vr3nu7mQs 5AA== X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA The ata_sas_port_alloc() wrapper mainly exists in order to export the internal libata function which it wraps. The secondary reason is that it initializes some ata_port struct members. However, ata_sas_port_alloc() is only used in a single location, sas_ata_init(), which already performs some ata_port struct member initialization, so it does not make sense to spread this initialization out over two separate locations. Thus, remove the wrapper and instead export the libata function directly, and move the libsas specific ata_port initialization to sas_ata_init(), which already does some ata_port initialization. Reviewed-by: Hannes Reinecke Signed-off-by: Niklas Cassel Reviewed-by: John Garry --- drivers/ata/libata-core.c | 1 + drivers/ata/libata-sata.c | 35 ----------------------------------- drivers/ata/libata.h | 1 - drivers/scsi/libsas/sas_ata.c | 20 +++++++++----------- include/linux/libata.h | 3 +-- 5 files changed, 11 insertions(+), 49 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 5031064834be..22e7b09c93b1 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5493,6 +5493,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host) return ap; } +EXPORT_SYMBOL_GPL(ata_port_alloc); void ata_port_free(struct ata_port *ap) { diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index b602247604dc..48660d445602 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -1204,41 +1204,6 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth) } EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth); -/** - * ata_sas_port_alloc - Allocate port for a SAS attached SATA device - * @host: ATA host container for all SAS ports - * @port_info: Information from low-level host driver - * @shost: SCSI host that the scsi device is attached to - * - * LOCKING: - * PCI/etc. bus probe sem. - * - * RETURNS: - * ata_port pointer on success / NULL on failure. - */ - -struct ata_port *ata_sas_port_alloc(struct ata_host *host, - struct ata_port_info *port_info, - struct Scsi_Host *shost) -{ - struct ata_port *ap; - - ap = ata_port_alloc(host); - if (!ap) - return NULL; - - ap->port_no = 0; - ap->pio_mask = port_info->pio_mask; - ap->mwdma_mask = port_info->mwdma_mask; - ap->udma_mask = port_info->udma_mask; - ap->flags |= port_info->flags; - ap->ops = port_info->port_ops; - ap->cbl = ATA_CBL_SATA; - - return ap; -} -EXPORT_SYMBOL_GPL(ata_sas_port_alloc); - /** * ata_sas_device_configure - Default device_configure routine for libata * devices diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 5ea194ae8a8b..6abf265f626e 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h @@ -81,7 +81,6 @@ extern void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp); extern int sata_link_init_spd(struct ata_link *link); extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg); extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg); -extern struct ata_port *ata_port_alloc(struct ata_host *host); extern const char *sata_spd_string(unsigned int spd); extern unsigned int ata_read_log_page(struct ata_device *dev, u8 log, u8 page, void *buf, unsigned int sectors); diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index ab4ddeea4909..88714b7b0dba 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -572,15 +572,6 @@ static struct ata_port_operations sas_sata_ops = { .end_eh = sas_ata_end_eh, }; -static struct ata_port_info sata_port_info = { - .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | ATA_FLAG_NCQ | - ATA_FLAG_SAS_HOST | ATA_FLAG_FPDMA_AUX, - .pio_mask = ATA_PIO4, - .mwdma_mask = ATA_MWDMA2, - .udma_mask = ATA_UDMA6, - .port_ops = &sas_sata_ops -}; - int sas_ata_init(struct domain_device *found_dev) { struct sas_ha_struct *ha = found_dev->port->ha; @@ -597,13 +588,20 @@ int sas_ata_init(struct domain_device *found_dev) ata_host_init(ata_host, ha->dev, &sas_sata_ops); - ap = ata_sas_port_alloc(ata_host, &sata_port_info, shost); + ap = ata_port_alloc(ata_host); if (!ap) { - pr_err("ata_sas_port_alloc failed.\n"); + pr_err("ata_port_alloc failed.\n"); rc = -ENODEV; goto free_host; } + ap->port_no = 0; + ap->pio_mask = ATA_PIO4; + ap->mwdma_mask = ATA_MWDMA2; + ap->udma_mask = ATA_UDMA6; + ap->flags |= ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | ATA_FLAG_NCQ | + ATA_FLAG_SAS_HOST | ATA_FLAG_FPDMA_AUX; + ap->ops = &sas_sata_ops; ap->private_data = found_dev; ap->cbl = ATA_CBL_SATA; ap->scsi_host = shost; diff --git a/include/linux/libata.h b/include/linux/libata.h index 84a7bfbac9fa..17394098bee9 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1244,9 +1244,8 @@ extern int sata_link_debounce(struct ata_link *link, extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, bool spm_wakeup); extern int ata_slave_link_init(struct ata_port *ap); -extern struct ata_port *ata_sas_port_alloc(struct ata_host *, - struct ata_port_info *, struct Scsi_Host *); extern void ata_port_probe(struct ata_port *ap); +extern struct ata_port *ata_port_alloc(struct ata_host *host); extern void ata_port_free(struct ata_port *ap); extern int ata_tport_add(struct device *parent, struct ata_port *ap); extern void ata_tport_delete(struct ata_port *ap); From patchwork Wed Jul 3 18:44:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 13722712 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 89AFD18C329; Wed, 3 Jul 2024 18:45:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032314; cv=none; b=l83p5htXgFCkE011MiU9hddouE2gn0P77P1k6QscJHwDgNaBOG1/x0cSdtP90rt7rpSjsf+N/m7jc6o/gnQUGQO0jIrgFKRNnnJN59TpUc+RELkixOk2h8PD5fxLRYOZLuA1vox92k2JJ992QDkRSLayrhBtHgY5a8Bs/5Ma+4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720032314; c=relaxed/simple; bh=LScu3KTtT8V2oLuw3+Jj58e5EN80mEeIxP4eOrJOtBg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KMfkoEreK90V0ohUP762CqoDlK4wn0GYbaDibqaScOWR5mgN7Ky6DAyEsugOHwdhTojsAZRsxLUFoe6ID6W9bzNHjoWQjAEriMUUhl/IKoKfQnqCJtVRpoaU+oFFkNdzf2g159qe5OstexmZ+WSfyf746yXCflQoEJHDH1/UGc8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mjVdJx+F; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mjVdJx+F" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A525C2BD10; Wed, 3 Jul 2024 18:45:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720032314; bh=LScu3KTtT8V2oLuw3+Jj58e5EN80mEeIxP4eOrJOtBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjVdJx+FJ5UErZo24v5Nx8NOtpkjQwZqA3YGLmprj85eQa4xALk1Gs0xmMAR8SR9m PAceL4MLVq1U3Ks5mnhAAGVhl9PvHcUaI+jlDmxeVix7m1EYlSfvhr+rcCKrn+KT2a SRv++DA/tX6DmkveOETXW0Hqf1y4dtVmnBJH0JZCuabx55QKHlLQ+ZoaIq+IFExwhv 5MI8K0py6f61dbOAdptMrtFmj7TCpNPL+crbhvUc4/PAd/wbWAj2BUl1d6djZquxAo UcXY6pIp28B893W+TpS/YhQq9s/HdoFRaecXsZow7ZGXcq1MaI0asjxTsuHzpxAvjc lZ5sxs5OkC0zA== From: Niklas Cassel To: Damien Le Moal , Niklas Cassel Cc: linux-scsi@vger.kernel.org, John Garry , Jason Yan , "Martin K. Petersen" , "James E.J. Bottomley" , Hannes Reinecke , linux-ide@vger.kernel.org Subject: [PATCH v4 9/9] ata: ahci: Add debug print for external port Date: Wed, 3 Jul 2024 20:44:26 +0200 Message-ID: <20240703184418.723066-20-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240703184418.723066-11-cassel@kernel.org> References: <20240703184418.723066-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=995; i=cassel@kernel.org; h=from:subject; bh=LScu3KTtT8V2oLuw3+Jj58e5EN80mEeIxP4eOrJOtBg=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJa5/Dtu7iyUVvxjvKcYG+9CaEpQd8vnf3jb6z3iJGtZ PbG2X6KHaUsDGJcDLJiiiy+P1z2F3e7TzmueMcGZg4rE8gQBi5OAZhIThDD//zaLVKpZjMXXnh5 TL2u4MUL7rmvC9ben/pGh43nYvKcawyMDBu+2X5Zy5U+yc5z5lfPY6mvvhpGHxMTVp67lWV/XvF eHXYA X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA Add a debug print that tells us if LPM is not getting enabled because the port is external. Reviewed-by: Damien Le Moal Reviewed-by: Hannes Reinecke Signed-off-by: Niklas Cassel --- drivers/ata/ahci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index fc6fd583faf8..a05c17249448 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c @@ -1732,8 +1732,10 @@ static void ahci_update_initial_lpm_policy(struct ata_port *ap) * Management Interaction in AHCI 1.3.1. Therefore, do not enable * LPM if the port advertises itself as an external port. */ - if (ap->pflags & ATA_PFLAG_EXTERNAL) + if (ap->pflags & ATA_PFLAG_EXTERNAL) { + ata_port_dbg(ap, "external port, not enabling LPM\n"); return; + } /* If no LPM states are supported by the HBA, do not bother with LPM */ if ((ap->host->flags & ATA_HOST_NO_PART) &&