From patchwork Tue Jul 2 16:07:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 1955495 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=bLwKVgmy; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-ide+bounces-1809-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WD7BW5KdZz1xpN for ; Wed, 3 Jul 2024 02:08:51 +1000 (AEST) 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 am.mirrors.kernel.org (Postfix) with ESMTPS id DBEE61F23496 for ; Tue, 2 Jul 2024 16:08:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB27B1BD02E; Tue, 2 Jul 2024 16:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bLwKVgmy" X-Original-To: linux-ide@vger.kernel.org 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 96244148825; Tue, 2 Jul 2024 16:08:42 +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=1719936522; cv=none; b=awumPQFBCWf51aMX71WJFkAlXFKfVF3If2hVqbx4U98rbHzfliFtHKCqSgmwqA5E9BVtbvBRauhrNXSaGjguHwjeswlOaGF3iG57qx2MRTXrW26EKPvxvhWZNaP12dokJrqlxwI37Qdqgq3b0nPoDihjCUDR24oZclZQc7N68VI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719936522; c=relaxed/simple; bh=u92l4xGXPhjRxlEy8appg1I3CAXjTva0uB8D7Zqnsh8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WzWeVtaJU/VcA+D+ljw9kPfLDY0a684BzFrCyLeQxlTbtjb5/7LxefkdzQpNdHn79/DAVGjVnrDxYFAMhigAhkAl9i/P93TJPDUer8aGqY5okFTuY25z6FQxg4Xol6MNQnbGXSccPntf+l0p92boQ0Lm28IWSnNl4xWdh44NrvE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bLwKVgmy; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66B3BC116B1; Tue, 2 Jul 2024 16:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719936522; bh=u92l4xGXPhjRxlEy8appg1I3CAXjTva0uB8D7Zqnsh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bLwKVgmyoIooYet13CuwvDlEHKZorsQuimJHQhRCxqXxgUv5ONaMz3ZkHGwtCH3+5 F+6YpijD2wLfbY/47LD5xDjIOMnwW/6obwBMFWWg49k5Xa/mh1inIzr7w68u3QNIBs CdDuZ1oHQIaQ0q3VREcgXSwEzKZXZGjavXKHijoLnOgMpJpwXEkFggxoV9r/ufSTGn 3C62ZS144RezETNjOSdgz9gKw9jmCz3G9s868zCXd2Y4GrfVFcgC3DQbcmNIcIcAal YGLybXO6OSgMNWxnIuN8K6EzMoAR2veyKQecljCNIflQs1twqW4j7Ylo1I3xAmHeMn G+HFlDDwy8cXw== 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 v3 1/9] ata,scsi: Remove useless wrappers ata_sas_tport_{add,delete}() Date: Tue, 2 Jul 2024 18:07:57 +0200 Message-ID: <20240702160756.596955-12-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702160756.596955-11-cassel@kernel.org> References: <20240702160756.596955-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-ide@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4345; i=cassel@kernel.org; h=from:subject; bh=u92l4xGXPhjRxlEy8appg1I3CAXjTva0uB8D7Zqnsh8=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJaVB/X/9Eq3PnTg+WWq+Fcjo0/X4v6/zTuiBPcoR/UE iAWbbalo5SFQYyLQVZMkcX3h8v+4m73KccV79jAzGFlAhnCwMUpABMRMGNkOCrXcl/eYLLLFv5z P3ez7Zz5+rFW3Mp7HNvmno/dENx+bB7DP/WsW61bkmx31zB5Wb+Pecco/fVN/uc6IU/Ol6vFlvt asgEA X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA Remove useless wrappers ata_sas_tport_add() and ata_sas_tport_delete(). Reviewed-by: Hannes Reinecke Signed-off-by: Niklas Cassel Reviewed-by: John Garry --- 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 Tue Jul 2 16:07:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 1955496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=ORPfyhB3; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=linux-ide+bounces-1810-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WD7BX3CC3z1xqd for ; Wed, 3 Jul 2024 02:08:52 +1000 (AEST) 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 10F72283949 for ; Tue, 2 Jul 2024 16:08:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E28761BD038; Tue, 2 Jul 2024 16:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ORPfyhB3" X-Original-To: linux-ide@vger.kernel.org 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 98CDB148825; Tue, 2 Jul 2024 16:08:45 +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=1719936525; cv=none; b=Q2tQCyeP8mm7qlrT5Be6gWXlA1PhI5fNwqO0neZ8tg7fdpFkig8xASP/st/lXbltdyP5WqsQNH+7qEDydB0BX1C+u4v6tgEWFJg4dYRFMmJ0TBxPpRHg0j3W8HFqVPOmRbfRzgebdw5l+34BMbUPTfTSStsd6uahj7yXQSTYypY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719936525; c=relaxed/simple; bh=gPbInyMbE7OFPzXDVK+ChS+iQcVWiyhWogsVEQ4IImk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U9Ee55xGZQlPMwv8pH3IFpZSoTHCmf1HUCOdyJpn8QhJNiZlklIpX0QtzpNJPRAcJ/IlOUspuqyOA2/PBhdm+1RKGNJdFTTnlLm/n7J97R06H7rhI3I+srl3r9fP6fRvGcvF08K/pq6TOxzewxP4HTRoi1AiWvxmkRd3/AnT1OU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ORPfyhB3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E8DFC116B1; Tue, 2 Jul 2024 16:08:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719936525; bh=gPbInyMbE7OFPzXDVK+ChS+iQcVWiyhWogsVEQ4IImk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ORPfyhB3WyIhCzajiMrCba8esOh9WskGQIfwpo5MqVeddHJIfFbxIm6QV+AF6PpDu GDeNzSnTJIPS4gu54sevx8vwRtrPml5Z1ht0QUPCYMOcFt3CdbS9bdNb2w+wEeFdNg Crke/rY9ltNODx2Qhf1LZWMa4crRLVvOCXpIjGzHmdyZdzKWELkfjr3JN/4ixoxcOf 8AcDh09Zl73RFtHJ3+cYBukp4nlf0QNOBqHAQoc4Jwnr2JC5+twbG8dQkSbs1E2qI5 kogpVQxkA6sdZBcPNNrL0Y7n/5NQJGwZjRQJw9qNaqOkOocLzBrs3E4gDhLW4q+jka RWE0uIIvsm4+g== 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 v3 2/9] ata: libata: Remove unused function declaration for ata_scsi_detect() Date: Tue, 2 Jul 2024 18:07:58 +0200 Message-ID: <20240702160756.596955-13-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702160756.596955-11-cassel@kernel.org> References: <20240702160756.596955-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-ide@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=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJaVB/vr5T1kNRUMLewzM0Tm3iFY87yN/d19N9d2irx9 gl/yXL7jlIWBjEuBlkxRRbfHy77i7vdpxxXvGMDM4eVCWQIAxenAExE1YGR4fgywVcqa7WXxGby MVfknRF9M1Eoubc2QOmlTODb5XoFQgz/bN+n/WM3npH/7N4Nyf4NjBf9GLo7rKfv9ipWdwn98nU KIwA= 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 Tue Jul 2 16:07:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 1955497 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Upws76iw; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.199.223; helo=ny.mirrors.kernel.org; envelope-from=linux-ide+bounces-1811-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WD7Bc45fTz1xpN for ; Wed, 3 Jul 2024 02:08:56 +1000 (AEST) 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7C84A1C2489F for ; Tue, 2 Jul 2024 16:08:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 939671BD025; Tue, 2 Jul 2024 16:08:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Upws76iw" X-Original-To: linux-ide@vger.kernel.org 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 500C3148825; Tue, 2 Jul 2024 16:08:48 +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=1719936528; cv=none; b=XaRLqJ7yDAuXBQ7qgAn4L7dPpJSVpyQe0apZvNpu9FOBCHL8Oh1dRfXnyElZvZUv8uctoNa3PGD25TMVuRrolDsjp3H6JwKTUNYbJAGOMmhtN41gJEE6sdwe7xFSRKe+1jfeTr2sA0kCElQo/NGiXdeCTJPDWVCK9NiGLlyymPg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719936528; c=relaxed/simple; bh=uL3qsxejMXbViNaxr/B+wibPmddp21cvRX8gRv8J9dU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aGfS+CleRyZ82kaP7Nfdf3e/ZziOKrzhwwuKr5G63cb797Yulo9paU72XOuIkFWN9F1TeANTBy7n4ftrlwKlB0kQ3/dqZgkRlw0OJcRYgQVeHIEminGqNZ7Dj6JuiSEoFOq70gm8zUTiFibtKXGfdx7DByRC8BKa4hS7CZdY2o8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Upws76iw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D3B1C116B1; Tue, 2 Jul 2024 16:08:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719936527; bh=uL3qsxejMXbViNaxr/B+wibPmddp21cvRX8gRv8J9dU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Upws76iwIz6bSe9js1vMrRSCuWumId25KqBVzStcA1Z+67ZfgOMrjINTFR1ruMIhD 4eZq1rCCtxsH6Cvkr1rdzjo6uubUQ/dTQ3A1vUCRSVRz/ZlNINV9zsv9YmiuNKUv+j n6e81PpmEezv5MgHnRXuhirWxU4+Ey1gBFiXqcHDwmUeCQx7K376znyHHCjqEuwl+o LNdDXi/1L5tZ71E/hvpcEutCWu5yCrFkQcjbFyNCdqSfzVcgmaGVLs62rALCEbkqwi 9sip69deH4GTT69SMyc2K1NVvh7CpFSd4Hp3R6bbShLz9LDHBdoIU9K4d1X2+EoIHp xZLrmcyjkuqkA== 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 v3 3/9] ata: libata-core: Remove support for decreasing the number of ports Date: Tue, 2 Jul 2024 18:07:59 +0200 Message-ID: <20240702160756.596955-14-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702160756.596955-11-cassel@kernel.org> References: <20240702160756.596955-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-ide@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=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJaVJ9scDPZ4m/CsWDT1cOne7RmfL0+9ZBX19YnJbb3a 54r6TaWdZSyMIhxMciKKbL4/nDZX9ztPuW44h0bmDmsTCBDGLg4BWAi2Y8ZGW5tqQm8px12/ICj Xt65ytSbq2c0fbQ9mhfd8JbjOXu7RADDH+4fE/eYOnCIClYs/Vepena+6un7LGF/1CQmi/Xraz7 5zAQA 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 Tue Jul 2 16:08:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 1955498 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Tn3uBd58; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-ide+bounces-1812-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WD7Bf4lnWz1xpN for ; Wed, 3 Jul 2024 02:08:58 +1000 (AEST) 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 614F7284CCD for ; Tue, 2 Jul 2024 16:08:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 678E01BD02E; Tue, 2 Jul 2024 16:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Tn3uBd58" X-Original-To: linux-ide@vger.kernel.org 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 2383D148825; Tue, 2 Jul 2024 16:08:50 +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=1719936531; cv=none; b=BjCffcgIkrmOypaaVkvRaucpR5q0bhnA/ZvMbR+k//4JQB+FoqsD+7+JOEeN4me8p4L8iQcQfrttBJfOmf4poNT5ja6GnTOhuARJcrcALD9T42tKngBC8clAqfz/dFiYfaLMQjLG8PUjQL3cGt6TIX5aDKzToQ/KvrO+BGj/oMw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719936531; c=relaxed/simple; bh=pJFjRC4pdUovu49pfV86X1dvnSXZmQTs5FtES/N36iQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GoEiI7yfgX8cwgTwvIncbfBUukhSMsZF5zc8VE7gzt+u2LXDHIvdvr2OJFeoWoyBiraliogquUq+dq1+lg+YzuwOCsOw0DeOBiheHoXAoTsGHpxft88WOxkuAWTPMJfVKo2N7vIUpw+IzdpzuhTL/KTwj2ZTpG1gXLY9EW1P8M8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Tn3uBd58; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99F72C116B1; Tue, 2 Jul 2024 16:08:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719936530; bh=pJFjRC4pdUovu49pfV86X1dvnSXZmQTs5FtES/N36iQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tn3uBd58ADWVPqADxtNUfR1AHhqTJdLJseOdsozQxZSkg+Gow4fp2ax3QJXFfS4to NXTsDKD0y0L3QFcy1xO29v7bSqbMJMvUGRwL/cvbUYOKJpED8POagKptjKK8Onxhuh mI7RAHT0JFNOJriToxfKd/TSv0s2PbLXZSxf+R3Db1oJU6Ts/9IKihnF0kMQXoTtsz bd8lmHsZJcj4/M55NvCN46FpSETFSQuL/cBGVVtfCrNgKtvlUH8+vTQ3Fyb7tc7Cqr T2/aSV3dnMvUUotrQeVvAEv5ETsBxOSS3vhe80EZWaV2nJI/jyuvu14W7Shy+lEecT SzPbjiAaplBhw== 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 v3 4/9] ata: libata-sata: Remove superfluous assignment in ata_sas_port_alloc() Date: Tue, 2 Jul 2024 18:08:00 +0200 Message-ID: <20240702160756.596955-15-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702160756.596955-11-cassel@kernel.org> References: <20240702160756.596955-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-ide@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=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJaVJ9wF9luvqZuwtOyNWcui829BO7Z67Zk9PyYxTalO YXnJdfCjlIWBjEuBlkxRRbfHy77i7vdpxxXvGMDM4eVCWQIAxenAExkrTMjw5X5nJsrvUvLHU6E JUV/OONz5P25gz4f+mYdWBmrHlNnXMHwv+Cz9iZJe5VDLdPY7k4I8rpZqK7L1RLxZ1HqK4df21m /cQEA 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 Tue Jul 2 16:08:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 1955499 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=pLqvpNmE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=linux-ide+bounces-1813-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WD7Bk1Xd5z1xpN for ; Wed, 3 Jul 2024 02:09:02 +1000 (AEST) 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 AE1F9B26BF8 for ; Tue, 2 Jul 2024 16:09:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1D2801BD037; Tue, 2 Jul 2024 16:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pLqvpNmE" X-Original-To: linux-ide@vger.kernel.org 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 CDC7A148825; Tue, 2 Jul 2024 16:08:53 +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=1719936533; cv=none; b=Ff1e0xywq27GeQMgeDgBZbUYJ6c/0DwK1hRTr6Ak4oCMbbPQB/isVgIh/r4hnceYAJpL6fwE6q0wDQkRfU+3ZDlTkZlqUefXcK6L83OtT92TjMyTkv6ek+5e2u8dU9K1UgxB3D76x7GeY+rfn/ifEFOhNzNCQkXADGBNRJTJVzw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719936533; c=relaxed/simple; bh=rGLhGA4U0nWfnf9gDicbn5UReSpLOrwyOSqv92NlJnE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M63pJlLmtSj3yhumWTN4Sz2y2+hxZwEjt5xRsucjwF/jXSPaD3Ju2/asBrupetUBXuHv+dT+1aP6hU5dbqXctxZUpTfzlHactMvMGT3bE2LbEexU8tOBe+l9CTu2vLfq3TMfhUcj9r6nAQJyBg36wTErW4sLerTMaRuPGlv4rhA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pLqvpNmE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94354C116B1; Tue, 2 Jul 2024 16:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719936533; bh=rGLhGA4U0nWfnf9gDicbn5UReSpLOrwyOSqv92NlJnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pLqvpNmEwgGzV/QpyKiwD0J/ZXtzd+E9sknDZ6hzl7BpcRGmLVLAGRx1Eut4rd3e6 gLvaet5Bg7trCOi/uxxDnma2xJsP8vu+KeHgYdAHpHPUvTgbaqpP8owXPUsCAWeBeZ 6k4m9wcs0cGPqQVKxf9tXleX5+fTS5VRKz7Tg64ObAMI/XIVG+Tf2/JZUvkoOxHoFN 8a9sK4spBqz6bNkkrB1Us12ecEI2U5DHTQffFZ9kHxSccrY9LNAARCovez+qovpd/V q2O9PcsH+uUL6PXrhFwOccwzuP+VnM52tkqSOpZYPRNfPtyWpWWdeWOka2vmbpqsFI Y3ZCFPL2954DA== 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 v3 5/9] ata: libata-core: Remove local_port_no struct member Date: Tue, 2 Jul 2024 18:08:01 +0200 Message-ID: <20240702160756.596955-16-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702160756.596955-11-cassel@kernel.org> References: <20240702160756.596955-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-ide@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=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJaVJ94K4YIMp75ps23qeykqlxF8cR1zyJD+IxFWJXbJ qTWnM7oKGVhEONikBVTZPH94bK/uNt9ynHFOzYwc1iZQIYwcHEKwERWnmL4K3l45STGtBkOot4y Z0VfVccyc7w13M35/c2UdpvGTbFbtBgZTnO80fO3K9G1i1/50Tv9QbOS4QrvVxWtXNf1qr+vPLC PEwA= 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 Tue Jul 2 16:08:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 1955500 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=Q7QcYq6x; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45e3:2400::1; helo=sv.mirrors.kernel.org; envelope-from=linux-ide+bounces-1814-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [IPv6:2604:1380:45e3:2400::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WD7Bm5t08z1xpN for ; Wed, 3 Jul 2024 02:09:04 +1000 (AEST) 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 98BD72866E4 for ; Tue, 2 Jul 2024 16:09:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F32E01BD01F; Tue, 2 Jul 2024 16:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q7QcYq6x" X-Original-To: linux-ide@vger.kernel.org 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 B0F8E148825; Tue, 2 Jul 2024 16:08: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=1719936536; cv=none; b=ohoWFjgPGqrqLfsGbiPqKcUUfDNVJCObVU4IO25yDBIMudlnMJFsi3BrRAZhK2Vt6BmZo1KFEQa5S45UuAb3yGoWQ09IERUrHeQLPtkFUcqksV7qK+fqhHgQ5iZqMKHiVbSdLM8A+CcsIPhzjUDvG5N43dWJQukINKwRdj4K5Hw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719936536; c=relaxed/simple; bh=tbDAh0q0cfWpxkoy8wWkLTXEdVgFDHunVlxbO8TdVRc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lH6wTeugOxXcZnEC3bh0awhBOS1HSdCfhgLNLQSJ+Qwohb6kgwKhwC0XvtQ95OSOdmvltCCgHslLye3SXlhWjCj3pNX8KA8IoUxTc140lFPas7qwcdN6fkl+89gDX1RdtCd93mJOMR/tdQ8IF2Pkhu20bKpwQLvQdiXA3aZudh4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q7QcYq6x; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81DF5C4AF0A; Tue, 2 Jul 2024 16:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719936536; bh=tbDAh0q0cfWpxkoy8wWkLTXEdVgFDHunVlxbO8TdVRc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q7QcYq6xp0ybX1VqpqrZ33gfFT3q/9QmziJhjTJPRX1VjotL4hg7d8XZk9IDMkcF3 VfRQDAzoJKjB4zOiS2CfHh9UKzcGZyNZ0y86JT3AtsDedV4YFQ0SRSajK8MW2XJ44y 5GXbcVXqUtEUChGaNxg8AaucQrvI3aFhPQvW1lZj0yHrV7HW7zML0hJPbQD9OZGB28 MyBD3N8C89cb5nvVdPAK8VVQ0PvdRxmpV0958f6kfy/V8ytRMCpl22uG9DSnN7jP7x ggzitLOszkG0GYDnmjJId5Zvg6fxLBUyeKM9nZq/vgOjkflYU2QbkHYhvbkCyiFD/P x5gwMBTp9Y1YA== 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 v3 6/9] ata: libata: Assign print_id at port allocation time Date: Tue, 2 Jul 2024 18:08:02 +0200 Message-ID: <20240702160756.596955-17-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702160756.596955-11-cassel@kernel.org> References: <20240702160756.596955-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-ide@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=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJaVJ9qVff5f5S4a+zoXMXqvy/G2JX1s2h3f8yb0nn8p me7Tot3lLIwiHExyIopsvj+cNlf3O0+5bjiHRuYOaxMIEMYuDgFYCL9UxgZ+qWX3J7waMNnz9AH B39bT17xL5T7hs6eiIMdSocL+BpllzH84TG/89lDhedtgF7NhxOW06esmv+x58HbphNLXzz5uOK +BisA 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 Tue Jul 2 16:08:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 1955501 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=SDgB+vPr; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-ide+bounces-1815-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WD7Bt6SPHz1xpN for ; Wed, 3 Jul 2024 02:09:10 +1000 (AEST) 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 08BBF1F2355B for ; Tue, 2 Jul 2024 16:09:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C93ED1BD02F; Tue, 2 Jul 2024 16:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SDgB+vPr" X-Original-To: linux-ide@vger.kernel.org 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 83D291BD02A; Tue, 2 Jul 2024 16:08: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=1719936539; cv=none; b=gtgBxXUGnApyieNImBJW2cFCa/Op52qwP8bl3gB0eR374cOo3zZUvjt7sm3/JDqgkAZJyjRzATXJjMF5ekPUJlNvvuX6KnifhUmLLcQw/sIfH+iVBAX+L4wVQcz0tT5Zvfspw7IuWFtT5FJAJcSi4TY/ClCv4tT8YpfgYrVdto0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719936539; c=relaxed/simple; bh=X7mlgOE0kf+ALAuEbjybN4/crwHxq36D50SYzF6JoYI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cNt89GicyTxSe299gzkV3RRNk/JHc1wQiGYoNtAfZO8VTtvUvsqV/BUtD0JsBhY8W5TRH9wSm/LczwNjZFyKa8iFGthF8FJ5NHM6JIhFvIyzUjk7cXIXjkTkTYZ6FOhbeSn4pKo77VBcrh8W52aBiPoaor0zEBH/GP6w5iiRCCI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SDgB+vPr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BEEDC4AF0A; Tue, 2 Jul 2024 16:08:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719936539; bh=X7mlgOE0kf+ALAuEbjybN4/crwHxq36D50SYzF6JoYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDgB+vPrG+WMu3vGV9e9Dy2/kDdteIW/xUfcCYVAoAFKzMXbRH/pxHsT/ebrBFX0R khJTfXu3Elt07k7dfrnoXnjjZcSIvhaaAN0yfcMJrlsmA977AYIa2xdOQJHY4NgKnJ EdxnmJFIkAoLEHYr9erxa2JB/6/ePLfbw2Ol4XdbEtsn/T1UxQMbUq7llIlmj93U+Y jsfDGSLHvq+lEWfSuqXP3o8xKnhP6+Hn3uMsFh8ECuC2WBeiRzKTepdeBdDgwHRvS0 GajyvdThtoZKmehoLXpx/zwyAn/jntXJClOECX9pvs73wZShABa0DkdfGvSmmpWZRs UGwWlJluEtj6Q== 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 v3 7/9] ata: libata-core: Reuse available ata_port print_ids Date: Tue, 2 Jul 2024 18:08:03 +0200 Message-ID: <20240702160756.596955-18-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702160756.596955-11-cassel@kernel.org> References: <20240702160756.596955-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-ide@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=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJaVJ/+8Jn05USTZZ7dnXfJzaHXdZ4xqpRvWStflPp0y kK7ibszO0pZGMS4GGTFFFl8f7jsL+52n3Jc8Y4NzBxWJpAhDFycAjCRRhOG/y4namb+Zr5sxnxC nYdh0TmDOVNKpbZ/bV4zPSgsSu6FvhDDP/U8QQffUpW7QsYHPnzfyTL9bRJbZ4BOgOk3V4t7gg1 xzAA= 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 Tue Jul 2 16:08:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 1955502 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=JLaZpjrp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=147.75.199.223; helo=ny.mirrors.kernel.org; envelope-from=linux-ide+bounces-1816-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [147.75.199.223]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WD7CC4xwqz1xpN for ; Wed, 3 Jul 2024 02:09:27 +1000 (AEST) 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 658041C24A26 for ; Tue, 2 Jul 2024 16:09:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DD901BD50E; Tue, 2 Jul 2024 16:09:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JLaZpjrp" X-Original-To: linux-ide@vger.kernel.org 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 BF47F1BD509; Tue, 2 Jul 2024 16:09: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=1719936542; cv=none; b=fxDq51/N8cYk/+cXb3fa0SqMQmptonlgDKhAHSs+q6mvBE38VG4SrZwNt9GFxwEGAWIfpLQh39epjnj03CD2vnzhlKF4AM929Evh0TjIC4WVvyXNPukoQps+o39XyqSR51wTxxXANWmNsmYHclAihtqt3OsTPw49bVIsWis7j8s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719936542; c=relaxed/simple; bh=2nXhznD2n9mOsTraJeYedHQ0dd5sSbCQv+ynUdP05NI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tSellL4292/qb5qU6QOWyR6mugk+oeWtSpU4cyZcU3xAS639+Hfw/FB3DZtXD24JLhdr15EFKbxIVorKILe7UpdMTKX76bPLimcXQM/q/Tif07MP3gxKiR+/m4oAFY5frkp31VkwGUiZ2ZjZgWWeFOxhvi7vUVIj6cpr9Hkn1UQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JLaZpjrp; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61267C116B1; Tue, 2 Jul 2024 16:09:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719936542; bh=2nXhznD2n9mOsTraJeYedHQ0dd5sSbCQv+ynUdP05NI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JLaZpjrpfv35c2JtAlDfcFZqCEo1b7ncq4PrKR22/s0dr2PhgHbZqs+UEGozNJ57h jeTSZ1TRLTn9WnCZyDVn6w+zBgamuhd9ntfcjPQO6pNBvc3MTqAdXEEFG8jSMu2DWf aosUUo3X+c6JWgj4EQVeD9MGH++Zw2f4rrw9qFjwsUm0JwaHUTDRHcItXKrkjo8xYp ZB3GxBOOi+VXKY2lNu+tEVhrCsNqo71/OCLcu5r1OYSFCUpJzS91x1f1QUbfGsc0ie FkA/tpbOm2kdYOglzOKOO85CuWfbxtkxg5LMVCLQojBCmPDLnxsvNvc6VtLxBQpgmD IfnPKiWo1XrYQ== 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 v3 8/9] ata,scsi: Remove useless ata_sas_port_alloc() wrapper Date: Tue, 2 Jul 2024 18:08:04 +0200 Message-ID: <20240702160756.596955-19-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702160756.596955-11-cassel@kernel.org> References: <20240702160756.596955-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-ide@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4634; i=cassel@kernel.org; h=from:subject; bh=2nXhznD2n9mOsTraJeYedHQ0dd5sSbCQv+ynUdP05NI=; b=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJaVJ/Z+Z9fuYNrDzvvnGMLP8rmLvxn337v+d+JgonLG bp4pwQEdZSyMIhxMciKKbL4/nDZX9ztPuW44h0bmDmsTCBDGLg4BWAiGgsYGdZdP1rWOksxkn3x 1s1HNps5Z97cUcH7+ZRwLHvY09tyTy4yMvzoeeXFoGtVMJn9T57vp5tnUm6FmRkqyc8LvcH4sKL qKCcA X-Developer-Key: i=cassel@kernel.org; a=openpgp; fpr=5ADE635C0E631CBBD5BE065A352FE6582ED9B5DA Now when the ap->print_id assignment has moved to ata_port_alloc(), we can remove the useless ata_sas_port_alloc() wrapper. Reviewed-by: Hannes Reinecke Signed-off-by: Niklas Cassel --- drivers/ata/libata-core.c | 1 + drivers/ata/libata-sata.c | 35 ----------------------------------- drivers/ata/libata.h | 1 - drivers/scsi/libsas/sas_ata.c | 10 ++++++++-- include/linux/libata.h | 3 +-- 5 files changed, 10 insertions(+), 40 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..80299f517081 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -597,13 +597,19 @@ 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 = sata_port_info.pio_mask; + ap->mwdma_mask = sata_port_info.mwdma_mask; + ap->udma_mask = sata_port_info.udma_mask; + ap->flags |= sata_port_info.flags; + ap->ops = sata_port_info.port_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 Tue Jul 2 16:08:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 1955503 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=tX5sOWoe; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:4601:e00::3; helo=am.mirrors.kernel.org; envelope-from=linux-ide+bounces-1817-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WD7CN2Gyyz1xpN for ; Wed, 3 Jul 2024 02:09:36 +1000 (AEST) 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 232A21F23B29 for ; Tue, 2 Jul 2024 16:09:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E49641BD01E; Tue, 2 Jul 2024 16:09:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tX5sOWoe" X-Original-To: linux-ide@vger.kernel.org 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 A334A148825; Tue, 2 Jul 2024 16:09: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=1719936545; cv=none; b=VgIIRDYP5BpFYB7SZpaKMLJsfw1I77wTzxEFjRGfOE/Ps8V6sFjHSXeczqvcuZ7IPbMojNozce/oSdBqooi0fn8WVVnU+SSph9N/L9Jjy8LDN57HlBzM4NXP/TEQjcDK0qJzzLud0CM5DJ/iMcd1t9814E/2JruII5I3DsDRuQ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719936545; c=relaxed/simple; bh=LScu3KTtT8V2oLuw3+Jj58e5EN80mEeIxP4eOrJOtBg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jIRsbYFnmnvYhatD01scq7pIQAU1tIOLJkx7BB5U6qOqoL/uIC3HzaYDPVEbbuMh/nbJW+qq9ZEM7m+5yUHjdgNyP83N/Bfn4SIH7SShee9h4o3Es3nCxH1srgK79R2sdmlfMJPNSjW4R8f9fKZHgM3lFq5ljTSfJpWFNAFs1/0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tX5sOWoe; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A4F2C116B1; Tue, 2 Jul 2024 16:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719936545; bh=LScu3KTtT8V2oLuw3+Jj58e5EN80mEeIxP4eOrJOtBg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tX5sOWoe/yXCZ2iHUw3dVF3mWeeMJNyvPNXX3rB4vt6yo6HMeWVHFraiYPqfWO2zB YPla3mjQ6ba4ljV5Hya5EiA9bG6+jKWSzMkVMIgyniSEDIeu2OM6cfdVdArU/sxxP1 M1Kn6idBdqoFIDEoHVRxR+ivs5KWebvn5OOwiXX1NFa6XFtSUZl5eyAD++zbZlhg9A t42JosbTeP1C5JlW3NJwHElYWs+xP1qomIgSCA8xbH1COmu9/ep7FiDk/7wNYy0iT6 qzEe4b0A6tI+J5UJrT5su6W8T/uyoq2tiV9vF+XMaObymmTlaFuhqxkM2U79t/OP3v RciaYAIU+LfvA== 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 v3 9/9] ata: ahci: Add debug print for external port Date: Tue, 2 Jul 2024 18:08:05 +0200 Message-ID: <20240702160756.596955-20-cassel@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240702160756.596955-11-cassel@kernel.org> References: <20240702160756.596955-11-cassel@kernel.org> Precedence: bulk X-Mailing-List: linux-ide@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=owGbwMvMwCV2MsVw8cxjvkWMp9WSGNJaVJ/tu7iyUVvxjvKcYG+9CaEpQd8vnf3jb6z3iJGtZ PbG2X6KHaUsDGJcDLJiiiy+P1z2F3e7TzmueMcGZg4rE8gQBi5OAZhIDjcjw+u7zAen3HKWdhaK 2r67y+N/zoP0aZvFjrhUWHf3tdhfjGVkeL9l1sZo6c83yt/VSM3YWb8swkQ+92hnyc85lQtetKi XcwIA 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) &&