From patchwork Mon Jul 31 14:34:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 708698 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 205ACC001E0 for ; Mon, 31 Jul 2023 14:37:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231892AbjGaOhZ (ORCPT ); Mon, 31 Jul 2023 10:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232420AbjGaOhY (ORCPT ); Mon, 31 Jul 2023 10:37:24 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6836118; Mon, 31 Jul 2023 07:37:18 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4fe1b00fce2so6277224e87.3; Mon, 31 Jul 2023 07:37:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690814237; x=1691419037; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6jFOzahW885iDt2pBEjY9OkGYfaRqtrfbKT8nbALKqs=; b=WWHmbsTlOTEYXtmm3eQGwnHQvG6W7pw7IAECLcbliOCMzpajJq4EYkzmGtUK1VsgDG KWBAOXL0y11i9WLs43jBCjLlwa2C80a6V76+jPiXScJpFd59NmjFKU+2Pzac4jRbC6u9 6WgyfgzQs976o9MZYjHmd4cYAULz3za2E8+KZUYN9wAuhY6w5n+qvdouN5mUdRRaNZVj L58vO3C77zioolYHuksBKK2qVh+Nm/0i52lpWzEv+a8iCFaYSCDHJyTX9uaDggWzA48a XLRE09KO83KHq6cLhmh4Oz7f9YkQ+ab7G9h/gFjMm5C0HNUVwtvtAcsYvY0PTdWUtO0S uBbg== X-Gm-Message-State: ABy/qLZabf+kcytqBoOAdUslAUZ4BljPieM7PKqwpzFmb/TUay1fBJt0 6ApnMK1g8EOx7/LMTKMO2uyy2ANkb6Vi7Q== X-Google-Smtp-Source: APBJJlGB0aK0ZKamOMqeSX8sPibFkUjzONbZL2gcUhAp5SG76gvrV14TjVxYZaDe1fhS+/XEo1hMsg== X-Received: by 2002:ac2:4e8b:0:b0:4f8:56cd:da8c with SMTP id o11-20020ac24e8b000000b004f856cdda8cmr14128lfr.34.1690814236923; Mon, 31 Jul 2023 07:37:16 -0700 (PDT) Received: from flawful.org (c-f5f0e255.011-101-6d6c6d3.bbcust.telenor.se. [85.226.240.245]) by smtp.gmail.com with ESMTPSA id d18-20020ac244d2000000b004fe26e36350sm1235298lfm.253.2023.07.31.07.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:37:16 -0700 (PDT) Received: by flawful.org (Postfix, from userid 112) id 9DB804018; Mon, 31 Jul 2023 16:37:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814235; bh=eHOoXJEObX7yHOxZohZ7Rfx1whOw8hkDIBs3dRM+8GE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eyUGGNz6VOqBu1qKGMljZEM56vop935sw5Hb4/vIqDX85q4ng8sWnBlyGIgv2DXo/ uLFLOA/PF/g+4tXzZBiGtP9LSQ3bf7lOy4oc/LZx9khSBPC0uQcGAArXewVbTJHYPf zrID81wiXccmsQx/FFACuj2CHWLKF++Il+J6bKws= Received: from x1-carbon.lan (OpenWrt.lan [192.168.1.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by flawful.org (Postfix) with ESMTPSA id AE2643F6E; Mon, 31 Jul 2023 16:34:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814087; bh=eHOoXJEObX7yHOxZohZ7Rfx1whOw8hkDIBs3dRM+8GE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CPdCkQjbNuSJGYIqmhPFgW+i8wxhEBAkfgwJWVc23xaycBMegR27SB2cKwNnhRw1K 8zKgIDUV3MwqON+soiFOnXei1Dw+BQd9woFvzh8Vo9xqp3Ap9Y4031XzRqxcj8Q1RI n/LXGQg/2LBJ51vZo9fx/+66ejQ9eu/Vd67QUeRw= From: Niklas Cassel To: Damien Le Moal Cc: Hannes Reinecke , John Garry , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Hannes Reinecke , Niklas Cassel , Jason Yan Subject: [PATCH v4 01/10] ata: remove reference to non-existing error_handler() Date: Mon, 31 Jul 2023 16:34:12 +0200 Message-ID: <20230731143432.58886-2-nks@flawful.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731143432.58886-1-nks@flawful.org> References: <20230731143432.58886-1-nks@flawful.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke With commit 65a15d6560df ("scsi: ipr: Remove SATA support") all libata drivers now have the error_handler() callback provided, so we can stop checking for non-existing error_handler callback. Signed-off-by: Hannes Reinecke [niklas: fixed review comments, rebased, solved conflicts during rebase, fixed bug that unconditionally dumped all QCs, removed the now unused function ata_dump_status(), removed the now unreachable failure paths in atapi_qc_complete(), removed the non-EH function to request ATAPI sense] Signed-off-by: Niklas Cassel Reviewed-by: John Garry Reviewed-by: Jason Yan --- drivers/ata/libata-core.c | 209 +++++++++++++++----------------------- drivers/ata/libata-eh.c | 152 ++++++++++++--------------- drivers/ata/libata-sata.c | 7 +- drivers/ata/libata-scsi.c | 161 ++--------------------------- drivers/ata/libata-sff.c | 30 ++---- include/linux/libata.h | 2 +- 6 files changed, 170 insertions(+), 391 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 04db0f2c683a..c7a29c3ac670 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -1586,13 +1586,11 @@ static unsigned ata_exec_internal_sg(struct ata_device *dev, } } - if (ap->ops->error_handler) - ata_eh_release(ap); + ata_eh_release(ap); rc = wait_for_completion_timeout(&wait, msecs_to_jiffies(timeout)); - if (ap->ops->error_handler) - ata_eh_acquire(ap); + ata_eh_acquire(ap); ata_sff_flush_pio_task(ap); @@ -1607,10 +1605,7 @@ static unsigned ata_exec_internal_sg(struct ata_device *dev, if (qc->flags & ATA_QCFLAG_ACTIVE) { qc->err_mask |= AC_ERR_TIMEOUT; - if (ap->ops->error_handler) - ata_port_freeze(ap); - else - ata_qc_complete(qc); + ata_port_freeze(ap); ata_dev_warn(dev, "qc timeout after %u msecs (cmd 0x%x)\n", timeout, command); @@ -4874,126 +4869,103 @@ static void ata_verify_xfer(struct ata_queued_cmd *qc) void ata_qc_complete(struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; + struct ata_device *dev = qc->dev; + struct ata_eh_info *ehi = &dev->link->eh_info; /* Trigger the LED (if available) */ ledtrig_disk_activity(!!(qc->tf.flags & ATA_TFLAG_WRITE)); - /* XXX: New EH and old EH use different mechanisms to - * synchronize EH with regular execution path. - * - * In new EH, a qc owned by EH is marked with ATA_QCFLAG_EH. - * Normal execution path is responsible for not accessing a - * qc owned by EH. libata core enforces the rule by returning NULL - * from ata_qc_from_tag() for qcs owned by EH. + /* + * In order to synchronize EH with the regular execution path, a qc that + * is owned by EH is marked with ATA_QCFLAG_EH. * - * Old EH depends on ata_qc_complete() nullifying completion - * requests if ATA_QCFLAG_EH_SCHEDULED is set. Old EH does - * not synchronize with interrupt handler. Only PIO task is - * taken care of. + * The normal execution path is responsible for not accessing a qc owned + * by EH. libata core enforces the rule by returning NULL from + * ata_qc_from_tag() for qcs owned by EH. */ - if (ap->ops->error_handler) { - struct ata_device *dev = qc->dev; - struct ata_eh_info *ehi = &dev->link->eh_info; - - if (unlikely(qc->err_mask)) - qc->flags |= ATA_QCFLAG_EH; + if (unlikely(qc->err_mask)) + qc->flags |= ATA_QCFLAG_EH; - /* - * Finish internal commands without any further processing - * and always with the result TF filled. - */ - if (unlikely(ata_tag_internal(qc->tag))) { - fill_result_tf(qc); - trace_ata_qc_complete_internal(qc); - __ata_qc_complete(qc); - return; - } + /* + * Finish internal commands without any further processing and always + * with the result TF filled. + */ + if (unlikely(ata_tag_internal(qc->tag))) { + fill_result_tf(qc); + trace_ata_qc_complete_internal(qc); + __ata_qc_complete(qc); + return; + } - /* - * Non-internal qc has failed. Fill the result TF and - * summon EH. - */ - if (unlikely(qc->flags & ATA_QCFLAG_EH)) { - fill_result_tf(qc); - trace_ata_qc_complete_failed(qc); - ata_qc_schedule_eh(qc); - return; - } + /* Non-internal qc has failed. Fill the result TF and summon EH. */ + if (unlikely(qc->flags & ATA_QCFLAG_EH)) { + fill_result_tf(qc); + trace_ata_qc_complete_failed(qc); + ata_qc_schedule_eh(qc); + return; + } - WARN_ON_ONCE(ata_port_is_frozen(ap)); + WARN_ON_ONCE(ata_port_is_frozen(ap)); - /* read result TF if requested */ - if (qc->flags & ATA_QCFLAG_RESULT_TF) - fill_result_tf(qc); + /* read result TF if requested */ + if (qc->flags & ATA_QCFLAG_RESULT_TF) + fill_result_tf(qc); - trace_ata_qc_complete_done(qc); + trace_ata_qc_complete_done(qc); + /* + * For CDL commands that completed without an error, check if we have + * sense data (ATA_SENSE is set). If we do, then the command may have + * been aborted by the device due to a limit timeout using the policy + * 0xD. For these commands, invoke EH to get the command sense data. + */ + if (qc->result_tf.status & ATA_SENSE && + ((ata_is_ncq(qc->tf.protocol) && + dev->flags & ATA_DFLAG_CDL_ENABLED) || + (!ata_is_ncq(qc->tf.protocol) && + ata_id_sense_reporting_enabled(dev->id)))) { /* - * For CDL commands that completed without an error, check if - * we have sense data (ATA_SENSE is set). If we do, then the - * command may have been aborted by the device due to a limit - * timeout using the policy 0xD. For these commands, invoke EH - * to get the command sense data. + * Tell SCSI EH to not overwrite scmd->result even if this + * command is finished with result SAM_STAT_GOOD. */ - if (qc->result_tf.status & ATA_SENSE && - ((ata_is_ncq(qc->tf.protocol) && - dev->flags & ATA_DFLAG_CDL_ENABLED) || - (!ata_is_ncq(qc->tf.protocol) && - ata_id_sense_reporting_enabled(dev->id)))) { - /* - * Tell SCSI EH to not overwrite scmd->result even if - * this command is finished with result SAM_STAT_GOOD. - */ - qc->scsicmd->flags |= SCMD_FORCE_EH_SUCCESS; - qc->flags |= ATA_QCFLAG_EH_SUCCESS_CMD; - ehi->dev_action[dev->devno] |= ATA_EH_GET_SUCCESS_SENSE; - - /* - * set pending so that ata_qc_schedule_eh() does not - * trigger fast drain, and freeze the port. - */ - ap->pflags |= ATA_PFLAG_EH_PENDING; - ata_qc_schedule_eh(qc); - return; - } + qc->scsicmd->flags |= SCMD_FORCE_EH_SUCCESS; + qc->flags |= ATA_QCFLAG_EH_SUCCESS_CMD; + ehi->dev_action[dev->devno] |= ATA_EH_GET_SUCCESS_SENSE; - /* Some commands need post-processing after successful - * completion. + /* + * set pending so that ata_qc_schedule_eh() does not trigger + * fast drain, and freeze the port. */ - switch (qc->tf.command) { - case ATA_CMD_SET_FEATURES: - if (qc->tf.feature != SETFEATURES_WC_ON && - qc->tf.feature != SETFEATURES_WC_OFF && - qc->tf.feature != SETFEATURES_RA_ON && - qc->tf.feature != SETFEATURES_RA_OFF) - break; - fallthrough; - case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */ - case ATA_CMD_SET_MULTI: /* multi_count changed */ - /* revalidate device */ - ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE; - ata_port_schedule_eh(ap); - break; + ap->pflags |= ATA_PFLAG_EH_PENDING; + ata_qc_schedule_eh(qc); + return; + } - case ATA_CMD_SLEEP: - dev->flags |= ATA_DFLAG_SLEEPING; + /* Some commands need post-processing after successful completion. */ + switch (qc->tf.command) { + case ATA_CMD_SET_FEATURES: + if (qc->tf.feature != SETFEATURES_WC_ON && + qc->tf.feature != SETFEATURES_WC_OFF && + qc->tf.feature != SETFEATURES_RA_ON && + qc->tf.feature != SETFEATURES_RA_OFF) break; - } - - if (unlikely(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) - ata_verify_xfer(qc); + fallthrough; + case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */ + case ATA_CMD_SET_MULTI: /* multi_count changed */ + /* revalidate device */ + ehi->dev_action[dev->devno] |= ATA_EH_REVALIDATE; + ata_port_schedule_eh(ap); + break; - __ata_qc_complete(qc); - } else { - if (qc->flags & ATA_QCFLAG_EH_SCHEDULED) - return; + case ATA_CMD_SLEEP: + dev->flags |= ATA_DFLAG_SLEEPING; + break; + } - /* read result TF if failed or requested */ - if (qc->err_mask || qc->flags & ATA_QCFLAG_RESULT_TF) - fill_result_tf(qc); + if (unlikely(dev->flags & ATA_DFLAG_DUBIOUS_XFER)) + ata_verify_xfer(qc); - __ata_qc_complete(qc); - } + __ata_qc_complete(qc); } EXPORT_SYMBOL_GPL(ata_qc_complete); @@ -5039,11 +5011,8 @@ void ata_qc_issue(struct ata_queued_cmd *qc) struct ata_link *link = qc->dev->link; u8 prot = qc->tf.protocol; - /* Make sure only one non-NCQ command is outstanding. The - * check is skipped for old EH because it reuses active qc to - * request ATAPI sense. - */ - WARN_ON_ONCE(ap->ops->error_handler && ata_tag_valid(link->active_tag)); + /* Make sure only one non-NCQ command is outstanding. */ + WARN_ON_ONCE(ata_tag_valid(link->active_tag)); if (ata_is_ncq(prot)) { WARN_ON_ONCE(link->sactive & (1 << qc->hw_tag)); @@ -5917,15 +5886,9 @@ void __ata_port_probe(struct ata_port *ap) int ata_port_probe(struct ata_port *ap) { - int rc = 0; - - if (ap->ops->error_handler) { - __ata_port_probe(ap); - ata_port_wait_eh(ap); - } else { - rc = ata_bus_probe(ap); - } - return rc; + __ata_port_probe(ap); + ata_port_wait_eh(ap); + return 0; } @@ -6130,9 +6093,6 @@ static void ata_port_detach(struct ata_port *ap) struct ata_link *link; struct ata_device *dev; - if (!ap->ops->error_handler) - goto skip_eh; - /* tell EH we're leaving & flush EH */ spin_lock_irqsave(ap->lock, flags); ap->pflags |= ATA_PFLAG_UNLOADING; @@ -6148,7 +6108,6 @@ static void ata_port_detach(struct ata_port *ap) cancel_delayed_work_sync(&ap->hotplug_task); cancel_delayed_work_sync(&ap->scsi_rescan_task); - skip_eh: /* clean up zpodd on port removal */ ata_for_each_link(link, ap, HOST_FIRST) { ata_for_each_dev(dev, link, ALL) { diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index 35e03679b0bf..9d6affabf225 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c @@ -571,13 +571,10 @@ void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap, /* make sure sff pio task is not running */ ata_sff_flush_pio_task(ap); - if (!ap->ops->error_handler) - return; - /* synchronize with host lock and sort out timeouts */ /* - * For new EH, all qcs are finished in one of three ways - + * For EH, all qcs are finished in one of three ways - * normal completion, error completion, and SCSI timeout. * Both completions can race against SCSI timeout. When normal * completion wins, the qc never reaches EH. When error @@ -659,94 +656,87 @@ EXPORT_SYMBOL(ata_scsi_cmd_error_handler); void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap) { unsigned long flags; + struct ata_link *link; - /* invoke error handler */ - if (ap->ops->error_handler) { - struct ata_link *link; - - /* acquire EH ownership */ - ata_eh_acquire(ap); + /* acquire EH ownership */ + ata_eh_acquire(ap); repeat: - /* kill fast drain timer */ - del_timer_sync(&ap->fastdrain_timer); + /* kill fast drain timer */ + del_timer_sync(&ap->fastdrain_timer); - /* process port resume request */ - ata_eh_handle_port_resume(ap); + /* process port resume request */ + ata_eh_handle_port_resume(ap); - /* fetch & clear EH info */ - spin_lock_irqsave(ap->lock, flags); + /* fetch & clear EH info */ + spin_lock_irqsave(ap->lock, flags); - ata_for_each_link(link, ap, HOST_FIRST) { - struct ata_eh_context *ehc = &link->eh_context; - struct ata_device *dev; + ata_for_each_link(link, ap, HOST_FIRST) { + struct ata_eh_context *ehc = &link->eh_context; + struct ata_device *dev; - memset(&link->eh_context, 0, sizeof(link->eh_context)); - link->eh_context.i = link->eh_info; - memset(&link->eh_info, 0, sizeof(link->eh_info)); + memset(&link->eh_context, 0, sizeof(link->eh_context)); + link->eh_context.i = link->eh_info; + memset(&link->eh_info, 0, sizeof(link->eh_info)); - ata_for_each_dev(dev, link, ENABLED) { - int devno = dev->devno; + ata_for_each_dev(dev, link, ENABLED) { + int devno = dev->devno; - ehc->saved_xfer_mode[devno] = dev->xfer_mode; - if (ata_ncq_enabled(dev)) - ehc->saved_ncq_enabled |= 1 << devno; - } + ehc->saved_xfer_mode[devno] = dev->xfer_mode; + if (ata_ncq_enabled(dev)) + ehc->saved_ncq_enabled |= 1 << devno; } + } - ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; - ap->pflags &= ~ATA_PFLAG_EH_PENDING; - ap->excl_link = NULL; /* don't maintain exclusion over EH */ + ap->pflags |= ATA_PFLAG_EH_IN_PROGRESS; + ap->pflags &= ~ATA_PFLAG_EH_PENDING; + ap->excl_link = NULL; /* don't maintain exclusion over EH */ - spin_unlock_irqrestore(ap->lock, flags); + spin_unlock_irqrestore(ap->lock, flags); - /* invoke EH, skip if unloading or suspended */ - if (!(ap->pflags & (ATA_PFLAG_UNLOADING | ATA_PFLAG_SUSPENDED))) - ap->ops->error_handler(ap); - else { - /* if unloading, commence suicide */ - if ((ap->pflags & ATA_PFLAG_UNLOADING) && - !(ap->pflags & ATA_PFLAG_UNLOADED)) - ata_eh_unload(ap); - ata_eh_finish(ap); - } + /* invoke EH, skip if unloading or suspended */ + if (!(ap->pflags & (ATA_PFLAG_UNLOADING | ATA_PFLAG_SUSPENDED))) + ap->ops->error_handler(ap); + else { + /* if unloading, commence suicide */ + if ((ap->pflags & ATA_PFLAG_UNLOADING) && + !(ap->pflags & ATA_PFLAG_UNLOADED)) + ata_eh_unload(ap); + ata_eh_finish(ap); + } - /* process port suspend request */ - ata_eh_handle_port_suspend(ap); + /* process port suspend request */ + ata_eh_handle_port_suspend(ap); - /* Exception might have happened after ->error_handler - * recovered the port but before this point. Repeat - * EH in such case. - */ - spin_lock_irqsave(ap->lock, flags); + /* + * Exception might have happened after ->error_handler recovered the + * port but before this point. Repeat EH in such case. + */ + spin_lock_irqsave(ap->lock, flags); - if (ap->pflags & ATA_PFLAG_EH_PENDING) { - if (--ap->eh_tries) { - spin_unlock_irqrestore(ap->lock, flags); - goto repeat; - } - ata_port_err(ap, - "EH pending after %d tries, giving up\n", - ATA_EH_MAX_TRIES); - ap->pflags &= ~ATA_PFLAG_EH_PENDING; + if (ap->pflags & ATA_PFLAG_EH_PENDING) { + if (--ap->eh_tries) { + spin_unlock_irqrestore(ap->lock, flags); + goto repeat; } + ata_port_err(ap, + "EH pending after %d tries, giving up\n", + ATA_EH_MAX_TRIES); + ap->pflags &= ~ATA_PFLAG_EH_PENDING; + } - /* this run is complete, make sure EH info is clear */ - ata_for_each_link(link, ap, HOST_FIRST) - memset(&link->eh_info, 0, sizeof(link->eh_info)); + /* this run is complete, make sure EH info is clear */ + ata_for_each_link(link, ap, HOST_FIRST) + memset(&link->eh_info, 0, sizeof(link->eh_info)); - /* end eh (clear host_eh_scheduled) while holding - * ap->lock such that if exception occurs after this - * point but before EH completion, SCSI midlayer will - * re-initiate EH. - */ - ap->ops->end_eh(ap); + /* + * end eh (clear host_eh_scheduled) while holding ap->lock such that if + * exception occurs after this point but before EH completion, SCSI + * midlayer will re-initiate EH. + */ + ap->ops->end_eh(ap); - spin_unlock_irqrestore(ap->lock, flags); - ata_eh_release(ap); - } else { - WARN_ON(ata_qc_from_tag(ap, ap->link.active_tag) == NULL); - ap->ops->eng_timeout(ap); - } + spin_unlock_irqrestore(ap->lock, flags); + ata_eh_release(ap); scsi_eh_flush_done_q(&ap->eh_done_q); @@ -912,8 +902,6 @@ void ata_qc_schedule_eh(struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; - WARN_ON(!ap->ops->error_handler); - qc->flags |= ATA_QCFLAG_EH; ata_eh_set_pending(ap, 1); @@ -934,8 +922,6 @@ void ata_qc_schedule_eh(struct ata_queued_cmd *qc) */ void ata_std_sched_eh(struct ata_port *ap) { - WARN_ON(!ap->ops->error_handler); - if (ap->pflags & ATA_PFLAG_INITIALIZING) return; @@ -989,8 +975,6 @@ static int ata_do_link_abort(struct ata_port *ap, struct ata_link *link) struct ata_queued_cmd *qc; int tag, nr_aborted = 0; - WARN_ON(!ap->ops->error_handler); - /* we're gonna abort all commands, no need for fast drain */ ata_eh_set_pending(ap, 0); @@ -1065,8 +1049,6 @@ EXPORT_SYMBOL_GPL(ata_port_abort); */ static void __ata_port_freeze(struct ata_port *ap) { - WARN_ON(!ap->ops->error_handler); - if (ap->ops->freeze) ap->ops->freeze(ap); @@ -1091,8 +1073,6 @@ static void __ata_port_freeze(struct ata_port *ap) */ int ata_port_freeze(struct ata_port *ap) { - WARN_ON(!ap->ops->error_handler); - __ata_port_freeze(ap); return ata_port_abort(ap); @@ -1112,9 +1092,6 @@ void ata_eh_freeze_port(struct ata_port *ap) { unsigned long flags; - if (!ap->ops->error_handler) - return; - spin_lock_irqsave(ap->lock, flags); __ata_port_freeze(ap); spin_unlock_irqrestore(ap->lock, flags); @@ -1134,9 +1111,6 @@ void ata_eh_thaw_port(struct ata_port *ap) { unsigned long flags; - if (!ap->ops->error_handler) - return; - spin_lock_irqsave(ap->lock, flags); ap->pflags &= ~ATA_PFLAG_FROZEN; diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 85e279a12f62..99d4ab04bcce 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -1158,12 +1158,7 @@ EXPORT_SYMBOL_GPL(ata_sas_port_alloc); */ int ata_sas_port_start(struct ata_port *ap) { - /* - * the port is marked as frozen at allocation time, but if we don't - * have new eh, we won't thaw it - */ - if (!ap->ops->error_handler) - ap->pflags &= ~ATA_PFLAG_FROZEN; + /* the port is marked as frozen at allocation time */ return 0; } EXPORT_SYMBOL_GPL(ata_sas_port_start); diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 370d18aca71e..9111d1b3c586 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -709,47 +709,6 @@ static void ata_qc_set_pc_nbytes(struct ata_queued_cmd *qc) qc->nbytes = scsi_bufflen(scmd) + qc->extrabytes; } -/** - * ata_dump_status - user friendly display of error info - * @ap: the port in question - * @tf: ptr to filled out taskfile - * - * Decode and dump the ATA error/status registers for the user so - * that they have some idea what really happened at the non - * make-believe layer. - * - * LOCKING: - * inherited from caller - */ -static void ata_dump_status(struct ata_port *ap, struct ata_taskfile *tf) -{ - u8 stat = tf->status, err = tf->error; - - if (stat & ATA_BUSY) { - ata_port_warn(ap, "status=0x%02x {Busy} ", stat); - } else { - ata_port_warn(ap, "status=0x%02x { %s%s%s%s%s%s%s} ", stat, - stat & ATA_DRDY ? "DriveReady " : "", - stat & ATA_DF ? "DeviceFault " : "", - stat & ATA_DSC ? "SeekComplete " : "", - stat & ATA_DRQ ? "DataRequest " : "", - stat & ATA_CORR ? "CorrectedError " : "", - stat & ATA_SENSE ? "Sense " : "", - stat & ATA_ERR ? "Error " : ""); - if (err) - ata_port_warn(ap, "error=0x%02x {%s%s%s%s%s%s", err, - err & ATA_ABORTED ? - "DriveStatusError " : "", - err & ATA_ICRC ? - (err & ATA_ABORTED ? - "BadCRC " : "Sector ") : "", - err & ATA_UNC ? "UncorrectableError " : "", - err & ATA_IDNF ? "SectorIdNotFound " : "", - err & ATA_TRK0NF ? "TrackZeroNotFound " : "", - err & ATA_AMNF ? "AddrMarkNotFound " : ""); - } -} - /** * ata_to_sense_error - convert ATA error to SCSI error * @id: ATA device number @@ -758,7 +717,6 @@ static void ata_dump_status(struct ata_port *ap, struct ata_taskfile *tf) * @sk: the sense key we'll fill out * @asc: the additional sense code we'll fill out * @ascq: the additional sense code qualifier we'll fill out - * @verbose: be verbose * * Converts an ATA error into a SCSI error. Fill out pointers to * SK, ASC, and ASCQ bytes for later use in fixed or descriptor @@ -768,7 +726,7 @@ static void ata_dump_status(struct ata_port *ap, struct ata_taskfile *tf) * spin_lock_irqsave(host lock) */ static void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, - u8 *asc, u8 *ascq, int verbose) + u8 *asc, u8 *ascq) { int i; @@ -847,7 +805,7 @@ static void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, *sk = sense_table[i][1]; *asc = sense_table[i][2]; *ascq = sense_table[i][3]; - goto translate_done; + return; } } } @@ -862,7 +820,7 @@ static void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, *sk = stat_table[i][1]; *asc = stat_table[i][2]; *ascq = stat_table[i][3]; - goto translate_done; + return; } } @@ -873,12 +831,6 @@ static void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, *sk = ABORTED_COMMAND; *asc = 0x00; *ascq = 0x00; - - translate_done: - if (verbose) - pr_err("ata%u: translated ATA stat/err 0x%02x/%02x to SCSI SK/ASC/ASCQ 0x%x/%02x/%02x\n", - id, drv_stat, drv_err, *sk, *asc, *ascq); - return; } /* @@ -904,7 +856,6 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc) struct ata_taskfile *tf = &qc->result_tf; unsigned char *sb = cmd->sense_buffer; unsigned char *desc = sb + 8; - int verbose = qc->ap->ops->error_handler == NULL; u8 sense_key, asc, ascq; memset(sb, 0, SCSI_SENSE_BUFFERSIZE); @@ -916,7 +867,7 @@ static void ata_gen_passthru_sense(struct ata_queued_cmd *qc) if (qc->err_mask || tf->status & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { ata_to_sense_error(qc->ap->print_id, tf->status, tf->error, - &sense_key, &asc, &ascq, verbose); + &sense_key, &asc, &ascq); ata_scsi_set_sense(qc->dev, cmd, sense_key, asc, ascq); } else { /* @@ -999,7 +950,6 @@ static void ata_gen_ata_sense(struct ata_queued_cmd *qc) struct scsi_cmnd *cmd = qc->scsicmd; struct ata_taskfile *tf = &qc->result_tf; unsigned char *sb = cmd->sense_buffer; - int verbose = qc->ap->ops->error_handler == NULL; u64 block; u8 sense_key, asc, ascq; @@ -1017,7 +967,7 @@ static void ata_gen_ata_sense(struct ata_queued_cmd *qc) if (qc->err_mask || tf->status & (ATA_BUSY | ATA_DF | ATA_ERR | ATA_DRQ)) { ata_to_sense_error(qc->ap->print_id, tf->status, tf->error, - &sense_key, &asc, &ascq, verbose); + &sense_key, &asc, &ascq); ata_scsi_set_sense(dev, cmd, sense_key, asc, ascq); } else { /* Could not decode error */ @@ -1179,9 +1129,6 @@ void ata_scsi_slave_destroy(struct scsi_device *sdev) unsigned long flags; struct ata_device *dev; - if (!ap->ops->error_handler) - return; - spin_lock_irqsave(ap->lock, flags); dev = __ata_scsi_find_dev(ap, sdev); if (dev && dev->sdev) { @@ -1668,7 +1615,6 @@ static void ata_qc_done(struct ata_queued_cmd *qc) static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) { - struct ata_port *ap = qc->ap; struct scsi_cmnd *cmd = qc->scsicmd; u8 *cdb = cmd->cmnd; int need_sense = (qc->err_mask != 0) && @@ -1692,9 +1638,6 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc) /* Keep the SCSI ML and status byte, clear host byte. */ cmd->result &= 0x0000ffff; - if (need_sense && !ap->ops->error_handler) - ata_dump_status(ap, &qc->result_tf); - ata_qc_done(qc); } @@ -2601,71 +2544,6 @@ static unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf) return 0; } -static void atapi_sense_complete(struct ata_queued_cmd *qc) -{ - if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) { - /* FIXME: not quite right; we don't want the - * translation of taskfile registers into - * a sense descriptors, since that's only - * correct for ATA, not ATAPI - */ - ata_gen_passthru_sense(qc); - } - - ata_qc_done(qc); -} - -/* is it pointless to prefer PIO for "safety reasons"? */ -static inline int ata_pio_use_silly(struct ata_port *ap) -{ - return (ap->flags & ATA_FLAG_PIO_DMA); -} - -static void atapi_request_sense(struct ata_queued_cmd *qc) -{ - struct ata_port *ap = qc->ap; - struct scsi_cmnd *cmd = qc->scsicmd; - - memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); - -#ifdef CONFIG_ATA_SFF - if (ap->ops->sff_tf_read) - ap->ops->sff_tf_read(ap, &qc->tf); -#endif - - /* fill these in, for the case where they are -not- overwritten */ - cmd->sense_buffer[0] = 0x70; - cmd->sense_buffer[2] = qc->tf.error >> 4; - - ata_qc_reinit(qc); - - /* setup sg table and init transfer direction */ - sg_init_one(&qc->sgent, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE); - ata_sg_init(qc, &qc->sgent, 1); - qc->dma_dir = DMA_FROM_DEVICE; - - memset(&qc->cdb, 0, qc->dev->cdb_len); - qc->cdb[0] = REQUEST_SENSE; - qc->cdb[4] = SCSI_SENSE_BUFFERSIZE; - - qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; - qc->tf.command = ATA_CMD_PACKET; - - if (ata_pio_use_silly(ap)) { - qc->tf.protocol = ATAPI_PROT_DMA; - qc->tf.feature |= ATAPI_PKT_DMA; - } else { - qc->tf.protocol = ATAPI_PROT_PIO; - qc->tf.lbam = SCSI_SENSE_BUFFERSIZE; - qc->tf.lbah = 0; - } - qc->nbytes = SCSI_SENSE_BUFFERSIZE; - - qc->complete_fn = atapi_sense_complete; - - ata_qc_issue(qc); -} - /* * ATAPI devices typically report zero for their SCSI version, and sometimes * deviate from the spec WRT response data format. If SCSI version is @@ -2691,9 +2569,8 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) struct scsi_cmnd *cmd = qc->scsicmd; unsigned int err_mask = qc->err_mask; - /* handle completion from new EH */ - if (unlikely(qc->ap->ops->error_handler && - (err_mask || qc->flags & ATA_QCFLAG_SENSE_VALID))) { + /* handle completion from EH */ + if (unlikely(err_mask || qc->flags & ATA_QCFLAG_SENSE_VALID)) { if (!(qc->flags & ATA_QCFLAG_SENSE_VALID)) { /* FIXME: not quite right; we don't want the @@ -2725,23 +2602,10 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) return; } - /* successful completion or old EH failure path */ - if (unlikely(err_mask & AC_ERR_DEV)) { - cmd->result = SAM_STAT_CHECK_CONDITION; - atapi_request_sense(qc); - return; - } else if (unlikely(err_mask)) { - /* FIXME: not quite right; we don't want the - * translation of taskfile registers into - * a sense descriptors, since that's only - * correct for ATA, not ATAPI - */ - ata_gen_passthru_sense(qc); - } else { - if (cmd->cmnd[0] == INQUIRY && (cmd->cmnd[1] & 0x03) == 0) - atapi_fixup_inquiry(cmd); - cmd->result = SAM_STAT_GOOD; - } + /* successful completion path */ + if (cmd->cmnd[0] == INQUIRY && (cmd->cmnd[1] & 0x03) == 0) + atapi_fixup_inquiry(cmd); + cmd->result = SAM_STAT_GOOD; ata_qc_done(qc); } @@ -4790,9 +4654,6 @@ int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, unsigned long flags; int devno, rc = 0; - if (!ap->ops->error_handler) - return -EOPNOTSUPP; - if (lun != SCAN_WILD_CARD && lun) return -EINVAL; diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 9d28badfe41d..84471d92cd1b 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c @@ -883,31 +883,21 @@ static void ata_hsm_qc_complete(struct ata_queued_cmd *qc, int in_wq) { struct ata_port *ap = qc->ap; - if (ap->ops->error_handler) { - if (in_wq) { - /* EH might have kicked in while host lock is - * released. - */ - qc = ata_qc_from_tag(ap, qc->tag); - if (qc) { - if (likely(!(qc->err_mask & AC_ERR_HSM))) { - ata_sff_irq_on(ap); - ata_qc_complete(qc); - } else - ata_port_freeze(ap); - } - } else { - if (likely(!(qc->err_mask & AC_ERR_HSM))) + if (in_wq) { + /* EH might have kicked in while host lock is released. */ + qc = ata_qc_from_tag(ap, qc->tag); + if (qc) { + if (likely(!(qc->err_mask & AC_ERR_HSM))) { + ata_sff_irq_on(ap); ata_qc_complete(qc); - else + } else ata_port_freeze(ap); } } else { - if (in_wq) { - ata_sff_irq_on(ap); - ata_qc_complete(qc); - } else + if (likely(!(qc->err_mask & AC_ERR_HSM))) ata_qc_complete(qc); + else + ata_port_freeze(ap); } } diff --git a/include/linux/libata.h b/include/linux/libata.h index 820f7a3a2749..3eeea76c30de 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1785,7 +1785,7 @@ static inline struct ata_queued_cmd *ata_qc_from_tag(struct ata_port *ap, { struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); - if (unlikely(!qc) || !ap->ops->error_handler) + if (unlikely(!qc)) return qc; if ((qc->flags & (ATA_QCFLAG_ACTIVE | From patchwork Mon Jul 31 14:34:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 709513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60624C41513 for ; Mon, 31 Jul 2023 14:37:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231721AbjGaOhU (ORCPT ); Mon, 31 Jul 2023 10:37:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231210AbjGaOhT (ORCPT ); Mon, 31 Jul 2023 10:37:19 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B81A718C; Mon, 31 Jul 2023 07:37:17 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2b974031aeaso68327361fa.0; Mon, 31 Jul 2023 07:37:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690814236; x=1691419036; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ClupZYKS8JeUk1us3Kwcw+jicJe7n/nJrCJP2EkCW4E=; b=WdB0XvdDtIcmLtxh3v98UEMexneqfrm+gu8IS+DtySID/lXwiHfmCpsw5xiNWJ0hi4 gFU7D0FWQ9SeswsnmDUlVHtyCHEH6gAPJG5m0eZYqwy8L06+6ed6jwD/cJxhN2emLpZX jegotFAQQlmXFw8EKY9ANEw35BwWl25WkDpnTQM4dyPuhymTXp6d7oo2Ue1yTLkAhk7D ebBlNkeXJWgJyvs9//nn95IaG82FtpGlkdxDmF6ZkKx54S8PyQKnpzDzFrYYxtz1VXln aIKyypC/qvsIHJUKaago1q+yOa87XpdGwO/Fq4jKndbKY7qtftxsVKEKmIZPowrKE4oi l8OQ== X-Gm-Message-State: ABy/qLbTf3krP3WzPd/pk4mmeWsoEfONTBATAobxcNMw5kcDauIhvB98 HipnJ4EXMfg1Xn3EwlnTP7qWA7N8oOIPoA== X-Google-Smtp-Source: APBJJlGA60tBkMqqqg24CY8U0/c7KwD9QpPms2R9yki9ULaCMhJtHD7LDeWJ+7mL8gKVjnsAe8dQ6Q== X-Received: by 2002:a2e:8eca:0:b0:2b9:d0dc:53a9 with SMTP id e10-20020a2e8eca000000b002b9d0dc53a9mr100411ljl.27.1690814235907; Mon, 31 Jul 2023 07:37:15 -0700 (PDT) Received: from flawful.org (c-f5f0e255.011-101-6d6c6d3.bbcust.telenor.se. [85.226.240.245]) by smtp.gmail.com with ESMTPSA id c3-20020a2e9483000000b002b6ea79c613sm2591761ljh.94.2023.07.31.07.37.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:37:15 -0700 (PDT) Received: by flawful.org (Postfix, from userid 112) id 8CE9E3F6E; Mon, 31 Jul 2023 16:37:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814234; bh=j0ZTQkAUQkYnLxb8vQUkk8v3PeseaLM00aHRAEfW8EU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vHr75Q6W+V3It+CL7/6FnYJOZu2z3ycOIUsED15bvKdRRtSVZt9yES7XUbz3wmuUy U35i5UwrXc6PwNDfptCzujuAYgOLel9mQMBwGu24YiCPumRhBdpFDrD8L6Kz1dzgzQ 6+KwCunXe65YmPHA6puqEHmlGZO41IO5jv7QvRjg= Received: from x1-carbon.lan (OpenWrt.lan [192.168.1.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by flawful.org (Postfix) with ESMTPSA id B5D8E4018; Mon, 31 Jul 2023 16:34:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814087; bh=j0ZTQkAUQkYnLxb8vQUkk8v3PeseaLM00aHRAEfW8EU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WzxRKOA9tJbeeBZx9gjmnW8EEUI74W+gPTYvBgh2dlk09DLqMs9xKWdLjLyY5Rc3g OrKNO19PuZAHVj9zYB5AmbK0t4LeYkG0+udsyXybxVwX1Up/uSpfUiQToOgaFq8QYT wj8cM5HpL5CW3lWvj6lAJN1WUF+wzIwl/kvqnYqg= From: Niklas Cassel To: Damien Le Moal , John Garry , Jason Yan , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Hannes Reinecke , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Hannes Reinecke , Niklas Cassel Subject: [PATCH v4 02/10] ata, scsi: remove ata_sas_port_{start, stop} callbacks Date: Mon, 31 Jul 2023 16:34:13 +0200 Message-ID: <20230731143432.58886-3-nks@flawful.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731143432.58886-1-nks@flawful.org> References: <20230731143432.58886-1-nks@flawful.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke Callbacks are empty now, so remove them. Also, remove the call to ap->ops->port_start() in ata_sas_port_init(), as this would otherwise cause a NULL pointer dereference, now when the callback is gone. Signed-off-by: Hannes Reinecke [niklas: remove the call to ap->ops->port_start() in ata_sas_port_init()] Signed-off-by: Niklas Cassel Reviewed-by: Jason Yan --- drivers/ata/libata-sata.c | 38 ----------------------------------- drivers/scsi/libsas/sas_ata.c | 2 -- include/linux/libata.h | 2 -- 3 files changed, 42 deletions(-) diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 99d4ab04bcce..a8256cb08763 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -1144,40 +1144,6 @@ struct ata_port *ata_sas_port_alloc(struct ata_host *host, } EXPORT_SYMBOL_GPL(ata_sas_port_alloc); -/** - * ata_sas_port_start - Set port up for dma. - * @ap: Port to initialize - * - * Called just after data structures for each port are - * initialized. - * - * May be used as the port_start() entry in ata_port_operations. - * - * LOCKING: - * Inherited from caller. - */ -int ata_sas_port_start(struct ata_port *ap) -{ - /* the port is marked as frozen at allocation time */ - return 0; -} -EXPORT_SYMBOL_GPL(ata_sas_port_start); - -/** - * ata_sas_port_stop - Undo ata_sas_port_start() - * @ap: Port to shut down - * - * May be used as the port_stop() entry in ata_port_operations. - * - * LOCKING: - * Inherited from caller. - */ - -void ata_sas_port_stop(struct ata_port *ap) -{ -} -EXPORT_SYMBOL_GPL(ata_sas_port_stop); - /** * ata_sas_async_probe - simply schedule probing and return * @ap: Port to probe @@ -1211,10 +1177,6 @@ EXPORT_SYMBOL_GPL(ata_sas_sync_probe); int ata_sas_port_init(struct ata_port *ap) { - int rc = ap->ops->port_start(ap); - - if (rc) - return rc; ap->print_id = atomic_inc_return(&ata_print_id); return 0; } diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 77714a495cbb..7ead1f1be97f 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -565,8 +565,6 @@ static struct ata_port_operations sas_sata_ops = { .qc_prep = ata_noop_qc_prep, .qc_issue = sas_ata_qc_issue, .qc_fill_rtf = sas_ata_qc_fill_rtf, - .port_start = ata_sas_port_start, - .port_stop = ata_sas_port_stop, .set_dmamode = sas_ata_set_dmamode, .sched_eh = sas_ata_sched_eh, .end_eh = sas_ata_end_eh, diff --git a/include/linux/libata.h b/include/linux/libata.h index 3eeea76c30de..5faf2d5d3da5 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1244,10 +1244,8 @@ extern struct ata_port *ata_sas_port_alloc(struct ata_host *, extern void ata_sas_async_probe(struct ata_port *ap); extern int ata_sas_sync_probe(struct ata_port *ap); extern int ata_sas_port_init(struct ata_port *); -extern int ata_sas_port_start(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 void ata_sas_port_stop(struct ata_port *ap); extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *); extern int ata_sas_queuecmd(struct scsi_cmnd *cmd, struct ata_port *ap); extern void ata_tf_to_fis(const struct ata_taskfile *tf, From patchwork Mon Jul 31 14:34:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 709512 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94CD4C001DE for ; Mon, 31 Jul 2023 14:37:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232420AbjGaOhm (ORCPT ); Mon, 31 Jul 2023 10:37:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232350AbjGaOhk (ORCPT ); Mon, 31 Jul 2023 10:37:40 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0ADFB10D; Mon, 31 Jul 2023 07:37:39 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2b9db1de50cso29223991fa.3; Mon, 31 Jul 2023 07:37:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690814257; x=1691419057; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=l3262UZbqhpzRYxsP7pqYyAwibxaw8SDUP49ZVnrvd4=; b=iTOOTSVqdwSzvPIYUyUe6K9pQfupA33whZ4nbMl6ckxYrGD/mHNn4RSRVWjG4sXsSZ zzN3WOe7YlaGqAuK/QJVMHI1klxLXthrTIuhThA4g7rC3kYjuZUSWlkN5lA4oNbpnKVL txE8De8dSxYG55EfIdgS+bJtggBH85+lVTzNb90jCj7Lw7mVOGQQpbbkqypTYB1hTbnC ICD4+j5YThSdzGzmGvQvy8bJzroyk6ZVl6y0ApUQA5rg3t0owSfjMxiBonaIzx4KwFir Di3FJR08PU4dBBFIaMfW436kF6SScqRsuGs1opGOugscbO1jxZWxj7sSWJ1x09bG9WG+ cNcw== X-Gm-Message-State: ABy/qLac1riRri//+2nQJtHYoYfUJyauW8ymFZ7iEoABMWXv8Th40rgQ oTi1lP2A3C/QwAw0zNGYPwZiBWComCN6Qw== X-Google-Smtp-Source: APBJJlEpfVZw7xjiV8YIPchfSVb5WSUzwuiIL8zOu1QQIZlC/mBPcmMdeeCapppS0s5vgFyGx/W91g== X-Received: by 2002:a2e:9208:0:b0:2b9:20fe:4bcc with SMTP id k8-20020a2e9208000000b002b920fe4bccmr131124ljg.21.1690814257245; Mon, 31 Jul 2023 07:37:37 -0700 (PDT) Received: from flawful.org (c-f5f0e255.011-101-6d6c6d3.bbcust.telenor.se. [85.226.240.245]) by smtp.gmail.com with ESMTPSA id o7-20020a2e90c7000000b002b9db7df0dasm1462020ljg.8.2023.07.31.07.37.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:37:36 -0700 (PDT) Received: by flawful.org (Postfix, from userid 112) id 20CFC3F6D; Mon, 31 Jul 2023 16:37:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814256; bh=aYpQaAOAdQJkKNUxNr2UGOSCBZVeg17udL95x37+lpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ECkbLa5OjO/fgDsUqyLMyPUticRPv/r3Xich/X63D6fNcrebilnvatpC0Y5RfuDSV ED4j99NgojirJnM+kuRQh3UbHGki/7i1S4cGc8zF+Kj+sT6sLs41KaACjeO6BT0GU2 nnn2FaEq9yjZ8anPk+yOf2tRp6P9K/OinvawvItg= Received: from x1-carbon.lan (OpenWrt.lan [192.168.1.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by flawful.org (Postfix) with ESMTPSA id ADBAF41C7; Mon, 31 Jul 2023 16:34:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814088; bh=aYpQaAOAdQJkKNUxNr2UGOSCBZVeg17udL95x37+lpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eBruudOLA8MGLY2ynZiUwAzuyeuKDRPI+pbThJeiAbh6wumpUV97BeGocGKhh14iz uy9/26C6/LSQQoh9pMQ7pAtHJrhocexzuxtVx/Yfpo3zrOd8XajsRKcM7wOBnh2Lji EjhLDm58yxOWHQNsUzXDMqeo4OSYB9x0mcQob8K8= From: Niklas Cassel To: Damien Le Moal , John Garry , Jason Yan , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Hannes Reinecke , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Hannes Reinecke , Niklas Cassel Subject: [PATCH v4 03/10] ata,scsi: remove ata_sas_port_destroy() Date: Mon, 31 Jul 2023 16:34:14 +0200 Message-ID: <20230731143432.58886-4-nks@flawful.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731143432.58886-1-nks@flawful.org> References: <20230731143432.58886-1-nks@flawful.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke Is now a wrapper around kfree(), so call it directly. Signed-off-by: Hannes Reinecke Signed-off-by: Niklas Cassel Reviewed-by: John Garry Reviewed-by: Jason Yan --- drivers/ata/libata-sata.c | 14 -------------- drivers/scsi/libsas/sas_ata.c | 2 +- drivers/scsi/libsas/sas_discover.c | 2 +- include/linux/libata.h | 1 - 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index a8256cb08763..b5de0f40ea25 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -1194,20 +1194,6 @@ void ata_sas_tport_delete(struct ata_port *ap) } EXPORT_SYMBOL_GPL(ata_sas_tport_delete); -/** - * ata_sas_port_destroy - Destroy a SATA port allocated by ata_sas_port_alloc - * @ap: SATA port to destroy - * - */ - -void ata_sas_port_destroy(struct ata_port *ap) -{ - if (ap->ops->port_stop) - ap->ops->port_stop(ap); - kfree(ap); -} -EXPORT_SYMBOL_GPL(ata_sas_port_destroy); - /** * ata_sas_slave_configure - Default slave_config routine for libata devices * @sdev: SCSI device to configure diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index 7ead1f1be97f..a2eb9a2191c0 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -619,7 +619,7 @@ int sas_ata_init(struct domain_device *found_dev) return 0; destroy_port: - ata_sas_port_destroy(ap); + kfree(ap); free_host: ata_host_put(ata_host); return rc; diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index 8c6afe724944..07e18cdb85c7 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c @@ -301,7 +301,7 @@ void sas_free_device(struct kref *kref) if (dev_is_sata(dev) && dev->sata_dev.ap) { ata_sas_tport_delete(dev->sata_dev.ap); - ata_sas_port_destroy(dev->sata_dev.ap); + kfree(dev->sata_dev.ap); ata_host_put(dev->sata_dev.ata_host); dev->sata_dev.ata_host = NULL; dev->sata_dev.ap = NULL; diff --git a/include/linux/libata.h b/include/linux/libata.h index 5faf2d5d3da5..bc755a1864a0 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1238,7 +1238,6 @@ 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 void ata_sas_port_destroy(struct ata_port *); extern struct ata_port *ata_sas_port_alloc(struct ata_host *, struct ata_port_info *, struct Scsi_Host *); extern void ata_sas_async_probe(struct ata_port *ap); From patchwork Mon Jul 31 14:34:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 708697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CDCBC41513 for ; Mon, 31 Jul 2023 14:38:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232532AbjGaOiO (ORCPT ); Mon, 31 Jul 2023 10:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232442AbjGaOiM (ORCPT ); Mon, 31 Jul 2023 10:38:12 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D829DE65; Mon, 31 Jul 2023 07:38:09 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4fe1a35a135so6743253e87.1; Mon, 31 Jul 2023 07:38:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690814288; x=1691419088; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+cvLEKb01KwEwiwYhn+J5gm5Rmx74arCYHgQsrDmFnM=; b=fVPH/HP6O4sBSHkmMOAGY4gnHNsNg0D2PfaIjR9M/UWpYOB4TuPh4g+xZL/+qQtDkC tnDZoX9z5Tt093nkGjWhIyIkg6SUcanlUPon7oS8UZCoJWaCSsQUUoUV+992OEALfSCV 0YPnNUYyGleKEqIvmXUjCoSmdr6RfD/X8zNy7pR3yMCn0P7rUFkxcv4JStpKeEZs3Snp eejM0NzMq12qQV3ZWzOltYk9N5pUaVENpoWvbAvJalVrUxCtfBGpz5FenMay1xE6p9Tt JwcXwyzudMq7ikway/nH/5+xMxW0vqHFcQTrudDCLyWvEuUASMoXcBPjy3od3g+LP8Dw UKxA== X-Gm-Message-State: ABy/qLbzkOsDUjri2Eq4wTqjC/sZ3EdpeMcZrTm/Tmkt4YofQj/en4yh lvpDSsANjBrg9H7JY7WKP2un22jMJTRdqg== X-Google-Smtp-Source: APBJJlFJ8C0Y45Km3ln9f2LKEupWqGAEAmku7CDy6SRrKJJz/+PhAUmqCuIjHboGAztbXwnMHx2Pyw== X-Received: by 2002:a05:6512:3c8d:b0:4f9:5426:6622 with SMTP id h13-20020a0565123c8d00b004f954266622mr7597598lfv.69.1690814287537; Mon, 31 Jul 2023 07:38:07 -0700 (PDT) Received: from flawful.org (c-f5f0e255.011-101-6d6c6d3.bbcust.telenor.se. [85.226.240.245]) by smtp.gmail.com with ESMTPSA id x9-20020ac259c9000000b004fe1e7f98c2sm1736882lfn.146.2023.07.31.07.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:38:00 -0700 (PDT) Received: by flawful.org (Postfix, from userid 112) id EAB113F16; Mon, 31 Jul 2023 16:37:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814278; bh=UwjA0ta5TWrlev0xT9Hy6DQIhdsAyjp7Nr9lw0njM+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P9RBoRh9ENuq7ULwj3ZZbRuRwDUuEQ5DO/JTGThm5qFXIMt7iyEH9WzzAHNuizvIU OBs4cvygagTU7PwCOOWlgPvEP1armk9+ZRb2W1GEmrlAntTXKKYmBuLrilZXlcnHx8 JcwF/2HiF+sERDaHVLmcEVZOnC68sgyqnahd07EY= Received: from x1-carbon.lan (OpenWrt.lan [192.168.1.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by flawful.org (Postfix) with ESMTPSA id 76DC241CC; Mon, 31 Jul 2023 16:34:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814092; bh=UwjA0ta5TWrlev0xT9Hy6DQIhdsAyjp7Nr9lw0njM+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HcgNmoZkQEi/gJo8XuDxZcEfdBZriZZm0PU2lHrraG9TsDRIC/em3Vi/E9Zu/EFIx yw5t1q7zG0yqx8H9z6tt2UnyTl/XLsK0QdQoAcDITxhSuwyHPGsvzzx30bQkTwWgFp GJ7cjCoyuU2jExZw4z+A6suTLVpQxGnSsVCXVi7A= From: Niklas Cassel To: Damien Le Moal Cc: Hannes Reinecke , John Garry , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Hannes Reinecke , Niklas Cassel , Jason Yan Subject: [PATCH v4 04/10] ata: remove ata_sas_sync_probe() Date: Mon, 31 Jul 2023 16:34:15 +0200 Message-ID: <20230731143432.58886-5-nks@flawful.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731143432.58886-1-nks@flawful.org> References: <20230731143432.58886-1-nks@flawful.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke Unused. Signed-off-by: Hannes Reinecke Signed-off-by: Niklas Cassel Reviewed-by: Jason Yan Reviewed-by: John Garry --- drivers/ata/libata-sata.c | 7 ------- include/linux/libata.h | 1 - 2 files changed, 8 deletions(-) diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index b5de0f40ea25..23252ebe312d 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -1157,13 +1157,6 @@ void ata_sas_async_probe(struct ata_port *ap) } EXPORT_SYMBOL_GPL(ata_sas_async_probe); -int ata_sas_sync_probe(struct ata_port *ap) -{ - return ata_port_probe(ap); -} -EXPORT_SYMBOL_GPL(ata_sas_sync_probe); - - /** * ata_sas_port_init - Initialize a SATA device * @ap: SATA port to initialize diff --git a/include/linux/libata.h b/include/linux/libata.h index bc755a1864a0..8e219c486a90 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1241,7 +1241,6 @@ 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_sas_async_probe(struct ata_port *ap); -extern int ata_sas_sync_probe(struct ata_port *ap); extern int ata_sas_port_init(struct ata_port *); extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap); extern void ata_sas_tport_delete(struct ata_port *ap); From patchwork Mon Jul 31 14:34:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 709511 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA1B5C001DE for ; Mon, 31 Jul 2023 14:38:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232477AbjGaOix (ORCPT ); Mon, 31 Jul 2023 10:38:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232442AbjGaOiv (ORCPT ); Mon, 31 Jul 2023 10:38:51 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3279911C; Mon, 31 Jul 2023 07:38:49 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4fe2de785e7so2514150e87.1; Mon, 31 Jul 2023 07:38:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690814327; x=1691419127; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=u2pZOghG3s3cE32OpecCVkbhH2lBZudb1L9QW7BuQ2Q=; b=TUmtLmckk6u6PlJldZhTZKtPXaXTz7SXGJSGFxyAXW5goysLHWvOoZ9fT3YhaRx8Ah z8DPS5AX6pArcyLvl9N1xxJZiQ63CXECYCx6IrHSz5FJ0qxZJ8MugF4cEuZFSabNH9Ka ajCda1thLfigbHegbPRYFa7BbHhkU0xRXBVFRZT8npSX5pu6OqexkeTepnatAYEcAA9J +x8b2GMV3RZYXqY7OHxptIojMkBee120TmxYiBDvB9MTx1mlG5rSabmtKOSeW0drHPDj cCX9FnFxoXl+9P/dPcLGj8qppDH7VTY1iWjh+lfAMBItm6FoWLaWTrTVp7cZnIQMXpnt sBxw== X-Gm-Message-State: ABy/qLahb19H4e6uJWGnAWBJI1q2SAIA8D4XuHosT0h5R5lcCdwMu/j6 MvQ/owAeg0yC+8z6Htq4rsw5DLHSQGeKNA== X-Google-Smtp-Source: APBJJlEljT4rb253lnTz1NMg2oOTYKq88hI5JJBYvpnpj3eI420SX9n5DBTPwZEGcuJZpA5SV2IT3w== X-Received: by 2002:a05:6512:308e:b0:4fb:7626:31a8 with SMTP id z14-20020a056512308e00b004fb762631a8mr21783lfd.27.1690814327320; Mon, 31 Jul 2023 07:38:47 -0700 (PDT) Received: from flawful.org (c-f5f0e255.011-101-6d6c6d3.bbcust.telenor.se. [85.226.240.245]) by smtp.gmail.com with ESMTPSA id q16-20020ac25110000000b004fe1fc5d0e3sm1638831lfb.206.2023.07.31.07.38.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:38:47 -0700 (PDT) Received: by flawful.org (Postfix, from userid 112) id 236604018; Mon, 31 Jul 2023 16:38:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814326; bh=dXBbRZp7PPSuBO724JgCVhzx+YcDxA1gCV+FO8yyma4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cOE9T3Wj00OfnoA5UmulNW+lGDe0daa2vPcjS9y7rnj2YjTVICoHAjgkfgv82drUw AInpTZ61xFe+6mO1OxaGp2O9BJCO8Y9pnNV/6/1gUXryYeQbD8RJQRMn4uYUF+yWRA gvw7yUWokKyN32iFSz/EoXZqXAe8Ns9bmeoRJ1lE= Received: from x1-carbon.lan (OpenWrt.lan [192.168.1.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by flawful.org (Postfix) with ESMTPSA id 69E0720F7; Mon, 31 Jul 2023 16:34:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814098; bh=dXBbRZp7PPSuBO724JgCVhzx+YcDxA1gCV+FO8yyma4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P5yNrjItzfHlKbm2Cg7aqzcVErOCGhywc0RqJliVJyBP079sESULTr3ooo1PPs4Ny jUhhmHwnWcEQXsJjqYM5l+8d8EkaR0HLF+ubmSsbpSamBA+FTsX5Uhc2vRSPFYNQbT Zs9mRH2H+FvmfTHT6py3eAWXiTBv9hD5FB61Otls= From: Niklas Cassel To: Damien Le Moal Cc: Hannes Reinecke , John Garry , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Hannes Reinecke , Niklas Cassel , Jason Yan Subject: [PATCH v4 05/10] ata: inline ata_port_probe() Date: Mon, 31 Jul 2023 16:34:16 +0200 Message-ID: <20230731143432.58886-6-nks@flawful.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731143432.58886-1-nks@flawful.org> References: <20230731143432.58886-1-nks@flawful.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke Just used in one place. Signed-off-by: Hannes Reinecke Signed-off-by: Niklas Cassel Reviewed-by: Jason Yan Reviewed-by: John Garry --- drivers/ata/libata-core.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index c7a29c3ac670..0cd10c44a7b1 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5884,14 +5884,6 @@ void __ata_port_probe(struct ata_port *ap) spin_unlock_irqrestore(ap->lock, flags); } -int ata_port_probe(struct ata_port *ap) -{ - __ata_port_probe(ap); - ata_port_wait_eh(ap); - return 0; -} - - static void async_port_probe(void *data, async_cookie_t cookie) { struct ata_port *ap = data; @@ -5906,7 +5898,8 @@ static void async_port_probe(void *data, async_cookie_t cookie) if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0) async_synchronize_cookie(cookie); - (void)ata_port_probe(ap); + __ata_port_probe(ap); + ata_port_wait_eh(ap); /* in order to keep device order, we need to synchronize at this point */ async_synchronize_cookie(cookie); From patchwork Mon Jul 31 14:34:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 708696 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AB26C41513 for ; Mon, 31 Jul 2023 14:39:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230135AbjGaOjA (ORCPT ); Mon, 31 Jul 2023 10:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229888AbjGaOi6 (ORCPT ); Mon, 31 Jul 2023 10:38:58 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47A3498; Mon, 31 Jul 2023 07:38:56 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4fe216edaf7so3687330e87.0; Mon, 31 Jul 2023 07:38:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690814334; x=1691419134; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=R9onvB4rgsW2JTUwB2kecOd0Elw2sgVRtptyLBBDeaI=; b=VF+S5Q0vrT8+MzPGE5D6aWK0lizcl4Grkjj02z7zreL6imnkaukNodI9aY19SIBbnr gBxf9kUCqZrg4VI7yItwa6pH3YT245+6Le/D30ipkbr4eaWv8JHfqXanrxu0HwwODcI4 yLXEp6pQ0WcMj3KF8GOeFx+7GrSumsQznxx7b3wLr+E47Zbi/wWPv3Rfe3bnITbbiXGK +d8yXa6tQfz/5AtSoufGUY2xeOIKgRoKcHbv5PEJkLmbwjRytLFdhi3wf5cNy2K2PEzR CIhh53pZStz4HbVNW4v1ilkGAEaUq3caFmxVR7mqn2uFBTUbPJKkLZ0Ollbc1AM3IpTg FtUQ== X-Gm-Message-State: ABy/qLYnsFjVF01bjgSKHIl3e0koDKCS7fraerqdKW8lqhb5lQdgGFr+ YHuGSmqy9YZzBt1hly84tziFfcRLnEdFdw== X-Google-Smtp-Source: APBJJlGIZYgB5oGJvBSHuUvb0lOYVUYQBbiFpVhBXUS8Q4fvLquX7VCu9yadmvgPh9DUdR0HAWXyGQ== X-Received: by 2002:a19:da11:0:b0:4f4:a656:2466 with SMTP id r17-20020a19da11000000b004f4a6562466mr7569lfg.15.1690814334379; Mon, 31 Jul 2023 07:38:54 -0700 (PDT) Received: from flawful.org (c-f5f0e255.011-101-6d6c6d3.bbcust.telenor.se. [85.226.240.245]) by smtp.gmail.com with ESMTPSA id a24-20020ac25218000000b004fde7ef2435sm2116555lfl.102.2023.07.31.07.38.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:38:54 -0700 (PDT) Received: by flawful.org (Postfix, from userid 112) id 3AC993F6E; Mon, 31 Jul 2023 16:38:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814333; bh=gEMJhh3YgEvucIdNEAwwpc/0r99iipK891nh+tiop/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sMiF90dOdQm6/Fx1gmLlsZ0x/La569WuMC8kOJnbjGV60V71YI+hYRTLRFsgqBhOL 6X006gCtMPVjqRTvhchZr7BmYh+mZb7MGwzznEWpwUPtyxtU26uB+MPqwQJaBoO3pM +n5+dUzqVwwV++TNQbX1mMBiBEtfQ5bg2ffIau4o= Received: from x1-carbon.lan (OpenWrt.lan [192.168.1.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by flawful.org (Postfix) with ESMTPSA id EBAA74A11; Mon, 31 Jul 2023 16:34:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814100; bh=gEMJhh3YgEvucIdNEAwwpc/0r99iipK891nh+tiop/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vBTrZkPh8/di73mhXBlL8WnOo6AzeMWPDxuNH51LxyiPQKDsJVhBa2W3hAepa83qp taxsF/xkOG1yRZK4Bokbdpvjx+5b58NAWOYf/h837IZ2LDStDtBKb678rYbisTzC/i lD6SDyQnQv3AEwqsZc8qePebqvqAE73GzS5D9+yw= From: Niklas Cassel To: Damien Le Moal , Xiang Chen , "James E.J. Bottomley" , "Martin K. Petersen" , John Garry , Jason Yan Cc: Hannes Reinecke , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Hannes Reinecke , Niklas Cassel Subject: [PATCH v4 06/10] ata,scsi: cleanup __ata_port_probe() Date: Mon, 31 Jul 2023 16:34:17 +0200 Message-ID: <20230731143432.58886-7-nks@flawful.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731143432.58886-1-nks@flawful.org> References: <20230731143432.58886-1-nks@flawful.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke Rename __ata_port_probe() to ata_port_probe() and drop the wrapper ata_sas_async_probe(). Signed-off-by: Hannes Reinecke Signed-off-by: Niklas Cassel Reviewed-by: Jason Yan Reviewed-by: John Garry --- drivers/ata/libata-core.c | 5 +++-- drivers/ata/libata-sata.c | 13 ------------- drivers/ata/libata.h | 2 -- drivers/scsi/hisi_sas/hisi_sas_main.c | 2 +- drivers/scsi/libsas/sas_ata.c | 2 +- include/linux/libata.h | 2 +- 6 files changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 0cd10c44a7b1..25a228350c75 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5865,7 +5865,7 @@ void ata_host_init(struct ata_host *host, struct device *dev, } EXPORT_SYMBOL_GPL(ata_host_init); -void __ata_port_probe(struct ata_port *ap) +void ata_port_probe(struct ata_port *ap) { struct ata_eh_info *ehi = &ap->link.eh_info; unsigned long flags; @@ -5883,6 +5883,7 @@ void __ata_port_probe(struct ata_port *ap) spin_unlock_irqrestore(ap->lock, flags); } +EXPORT_SYMBOL_GPL(ata_port_probe); static void async_port_probe(void *data, async_cookie_t cookie) { @@ -5898,7 +5899,7 @@ static void async_port_probe(void *data, async_cookie_t cookie) if (!(ap->host->flags & ATA_HOST_PARALLEL_SCAN) && ap->port_no != 0) async_synchronize_cookie(cookie); - __ata_port_probe(ap); + ata_port_probe(ap); ata_port_wait_eh(ap); /* in order to keep device order, we need to synchronize at this point */ diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index 23252ebe312d..c0253adbf47c 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -1144,19 +1144,6 @@ struct ata_port *ata_sas_port_alloc(struct ata_host *host, } EXPORT_SYMBOL_GPL(ata_sas_port_alloc); -/** - * ata_sas_async_probe - simply schedule probing and return - * @ap: Port to probe - * - * For batch scheduling of probe for sas attached ata devices, assumes - * the port has already been through ata_sas_port_init() - */ -void ata_sas_async_probe(struct ata_port *ap) -{ - __ata_port_probe(ap); -} -EXPORT_SYMBOL_GPL(ata_sas_async_probe); - /** * ata_sas_port_init - Initialize a SATA device * @ap: SATA port to initialize diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index cf993885d2b2..1ec9b4427b84 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h @@ -78,8 +78,6 @@ 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 int ata_port_probe(struct ata_port *ap); -extern void __ata_port_probe(struct ata_port *ap); 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/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c index 8f22ece957bd..b2f07c6f30e7 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_main.c +++ b/drivers/scsi/hisi_sas/hisi_sas_main.c @@ -787,7 +787,7 @@ static int hisi_sas_init_device(struct domain_device *device) * However we don't need to issue a hard reset here for these * reasons: * a. When probing the device, libsas/libata already issues a - * hard reset in sas_probe_sata() -> ata_sas_async_probe(). + * hard reset in sas_probe_sata() -> ata_port_probe(). * Note that in hisi_sas_debug_I_T_nexus_reset() we take care * to issue a hard reset by checking the dev status (== INIT). * b. When resetting the controller, this is simply unnecessary. diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index a2eb9a2191c0..d6bb37b3974a 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -653,7 +653,7 @@ void sas_probe_sata(struct asd_sas_port *port) if (!dev_is_sata(dev)) continue; - ata_sas_async_probe(dev->sata_dev.ap); + ata_port_probe(dev->sata_dev.ap); } mutex_unlock(&port->ha->disco_mutex); diff --git a/include/linux/libata.h b/include/linux/libata.h index 8e219c486a90..67e34948eac8 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1240,7 +1240,7 @@ extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, 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_sas_async_probe(struct ata_port *ap); +extern void ata_port_probe(struct ata_port *ap); extern int ata_sas_port_init(struct ata_port *); extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap); extern void ata_sas_tport_delete(struct ata_port *ap); From patchwork Mon Jul 31 14:34:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 708695 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2DA7C41513 for ; Mon, 31 Jul 2023 14:40:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232597AbjGaOkH (ORCPT ); Mon, 31 Jul 2023 10:40:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232427AbjGaOkC (ORCPT ); Mon, 31 Jul 2023 10:40:02 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05490D3; Mon, 31 Jul 2023 07:40:01 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4fe28f92d8eso2810258e87.1; Mon, 31 Jul 2023 07:40:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690814399; x=1691419199; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2k+q14ps53lS2O6/mpuHT4ZklVrr/y/XhvkOCRi7rPM=; b=LCTo6jj539VMNtZ5OESohNoW98yw9fav9SazJn/DUu27tccxzsLAvHnbQok041PCtR DjwK0Oc1fdKy42ZKjdf1zmbxcoeTzKPj3TLkws+ONxpBtxLHrzcE+qd2RMNroEc59g7c mjNKjnn+Dcgj126LhpjAyJALYUqaMQQpcADub0rz/Nn0Hn2GEuh6SDEVRU7hgXvdQxI2 PK7bLaDaCB+Y2pknO7zO6yx03QJKcqAh5ezsBbxb2MSkjm4EvKn3Jal+zlywPx9PRcW6 FMvSqDFHh1CmiJlCCRjp/BHuNyMll+akBCfhtgdW5oMty3SeEaFugxKyyM+qUb0bVjBS NWAQ== X-Gm-Message-State: ABy/qLZZsLH1TneZ166/p3T1Y95yzgYLXK1mFU3VN4t3/qKcBYHgZkmu FcK44yR9CA0EPuAJycA5ApKW/g+dScdOTA== X-Google-Smtp-Source: APBJJlH5/pJT2s/RmZHQZVLm3pWlA1X5Eu/6rrwBDTurYN8nPkrQGHpfmujeKkp1YsSK7Ej9MTeHpQ== X-Received: by 2002:a2e:990c:0:b0:2b7:3656:c594 with SMTP id v12-20020a2e990c000000b002b73656c594mr136983lji.3.1690814399118; Mon, 31 Jul 2023 07:39:59 -0700 (PDT) Received: from flawful.org (c-f5f0e255.011-101-6d6c6d3.bbcust.telenor.se. [85.226.240.245]) by smtp.gmail.com with ESMTPSA id c4-20020a2ea1c4000000b002b71c128ea0sm2577011ljm.117.2023.07.31.07.39.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:39:58 -0700 (PDT) Received: by flawful.org (Postfix, from userid 112) id D164B3F16; Mon, 31 Jul 2023 16:39:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814397; bh=Rs5bVez7dh0ggEARvKEKRWHe0daPIEAEP7tmoRQH+uA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WWfZmbpJXjZeGdpUrVlRrpzQPCUiMMelROeeDo21bmzZPNo5FT+JXZFZGQ0o/hvrf ByxE4oh4YRKCWi91/JlA6nV23hTkEEgTcLGTjmHtxACa4pUBbZyRM+RbalmKNu31kJ BMP7qbXynnYhfASH+Pi+Y6SCTf1tUPxpYb54kWeg= Received: from x1-carbon.lan (OpenWrt.lan [192.168.1.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by flawful.org (Postfix) with ESMTPSA id E21FD4A2E; Mon, 31 Jul 2023 16:35:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814101; bh=Rs5bVez7dh0ggEARvKEKRWHe0daPIEAEP7tmoRQH+uA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rCifNetFSJfOM3wBIAVocJjatZbRFQO0Pnwm/HtNIdBFet/Ll4YU2UoMhYgWCrJDt TiU6hPsMt1f87pBk/4sKccq/Xffk2M7axMDRE/4clZYsEJ4EN+zzOFsG688s9JCnna QbJ8n6M3262OAPnFZuOyzNHBDn5MfVIRe73eFX/0= From: Niklas Cassel To: Damien Le Moal , John Garry , Jason Yan , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Hannes Reinecke , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Niklas Cassel Subject: [PATCH v4 07/10] ata,scsi: remove ata_sas_port_init() Date: Mon, 31 Jul 2023 16:34:18 +0200 Message-ID: <20230731143432.58886-8-nks@flawful.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731143432.58886-1-nks@flawful.org> References: <20230731143432.58886-1-nks@flawful.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Niklas Cassel ata_sas_port_init() now only contains a single initialization. Move this single initialization to ata_sas_port_alloc(), since: 1) ata_sas_port_alloc() already initializes some of the struct members. 2) ata_sas_port_alloc() is only used by libsas. Suggested-by: John Garry Signed-off-by: Niklas Cassel --- drivers/ata/libata-sata.c | 19 +------------------ drivers/scsi/libsas/sas_ata.c | 3 --- include/linux/libata.h | 1 - 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/drivers/ata/libata-sata.c b/drivers/ata/libata-sata.c index c0253adbf47c..5e6f21ca3567 100644 --- a/drivers/ata/libata-sata.c +++ b/drivers/ata/libata-sata.c @@ -1139,29 +1139,12 @@ 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; } EXPORT_SYMBOL_GPL(ata_sas_port_alloc); -/** - * ata_sas_port_init - Initialize a SATA device - * @ap: SATA port to initialize - * - * LOCKING: - * PCI/etc. bus probe sem. - * - * RETURNS: - * Zero on success, non-zero on error. - */ - -int ata_sas_port_init(struct ata_port *ap) -{ - ap->print_id = atomic_inc_return(&ata_print_id); - return 0; -} -EXPORT_SYMBOL_GPL(ata_sas_port_init); - int ata_sas_tport_add(struct device *parent, struct ata_port *ap) { return ata_tport_add(parent, ap); diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c index d6bb37b3974a..cd16a1ac379d 100644 --- a/drivers/scsi/libsas/sas_ata.c +++ b/drivers/scsi/libsas/sas_ata.c @@ -605,9 +605,6 @@ int sas_ata_init(struct domain_device *found_dev) ap->private_data = found_dev; ap->cbl = ATA_CBL_SATA; ap->scsi_host = shost; - rc = ata_sas_port_init(ap); - if (rc) - goto destroy_port; rc = ata_sas_tport_add(ata_host->dev, ap); if (rc) diff --git a/include/linux/libata.h b/include/linux/libata.h index 67e34948eac8..05d2fc0df553 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1241,7 +1241,6 @@ 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 int ata_sas_port_init(struct ata_port *); 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_sas_slave_configure(struct scsi_device *, struct ata_port *); From patchwork Mon Jul 31 14:34:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 709510 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C602EC001DF for ; Mon, 31 Jul 2023 14:39:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232532AbjGaOj7 (ORCPT ); Mon, 31 Jul 2023 10:39:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232427AbjGaOj6 (ORCPT ); Mon, 31 Jul 2023 10:39:58 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FD5898; Mon, 31 Jul 2023 07:39:57 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-4fe2de785e7so2516667e87.1; Mon, 31 Jul 2023 07:39:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690814395; x=1691419195; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xS4BSNtCM8QPszrM2uOPIUUqPohq4b5SBY4337MvfXc=; b=Lm3rebF6m06lA5OMuOPmG4rYIdZKxwdMlMho9SUKL0Cr270Dj5lPJLrFAjDbYnpI6s zW1Ol19Tv/rheBQbJ2t/RR9BIHsGQ/XC+wN2i5+dnIRawmVqVWjmB86EGh3ZYz4kkcFM d3IKBTrFE2fS1kApSjRhoYdm6I8/kLOvvpsy4Xz1d6GpCWYp+/F3av/K3V/YmIg8gH4u PA/QJ0wi+txhHyf5/vRhlo39aq/8YHgUvQcY8xap7ZyVI54AX4zzL6TOgbbRjJeuSjeA UPbigOieTECXg4IKM1eFQsnOpO3fZQo9qfzdRKDTbZ/dF0VeSO4uVz3huT7gv/MkafcX s59A== X-Gm-Message-State: ABy/qLYw/n8ocBFKvvLZwr0SwCT9t3P8aRIMMejTJEGznKCtHfrud6Hd P9HfX8jRcLelKkiAsHk3Ll0QkG685rp35A== X-Google-Smtp-Source: APBJJlE4d2f7BW/V6oWUrg+kS4SGY5P3tmuh2R7HQ6ZgB0qaAbM+DoIuyARLqHVestBalcOFqWyDeQ== X-Received: by 2002:a05:6512:3ae:b0:4f8:4177:e087 with SMTP id v14-20020a05651203ae00b004f84177e087mr2501lfp.47.1690814395465; Mon, 31 Jul 2023 07:39:55 -0700 (PDT) Received: from flawful.org (c-f5f0e255.011-101-6d6c6d3.bbcust.telenor.se. [85.226.240.245]) by smtp.gmail.com with ESMTPSA id h24-20020a197018000000b004fe36bae2d6sm520530lfc.81.2023.07.31.07.39.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:39:55 -0700 (PDT) Received: by flawful.org (Postfix, from userid 112) id 4BDBC3F16; Mon, 31 Jul 2023 16:39:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814394; bh=ELnVuTXctBQjkuk5W9EeF+K2wH7nuVg+vU9Nx/2DtQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FMWV81B3g0SCjfmW66t9LQ8TFlOrSqXCC6AssfRRHxfeL2fo4jYbh1Sz/Qbv2AMbU mOWFyiIyoXA8HdVoYfLD5nV/dvIMhDWW7fVQveodv2aXXqW0TDxtrmMiYjAROcxzlj uIL7s+ReteeqFeHLPyK2H/UsasbWmoSSbWlYv1+k= Received: from x1-carbon.lan (OpenWrt.lan [192.168.1.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by flawful.org (Postfix) with ESMTPSA id B5EAF41C8; Mon, 31 Jul 2023 16:35:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814101; bh=ELnVuTXctBQjkuk5W9EeF+K2wH7nuVg+vU9Nx/2DtQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e9LWOtgPn6YUQWhM3YbqE4lUvZAw4JU4QSEtjZ/8a56/ESntc2Sq4beUwhggdWar4 0G/nwMWVYNavCYrrOwmpnuuW/M57M01IsYYifSopZMIr1OU/J4IiCNixclzwqw82Pm s+lRciuO6bXirjJQyf3Q6zvuif5z+/FVJcyYIi6M= From: Niklas Cassel To: Damien Le Moal Cc: Hannes Reinecke , John Garry , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Niklas Cassel , Hannes Reinecke , Jason Yan Subject: [PATCH v4 08/10] ata: sata_sx4: drop already completed TODO Date: Mon, 31 Jul 2023 16:34:19 +0200 Message-ID: <20230731143432.58886-9-nks@flawful.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731143432.58886-1-nks@flawful.org> References: <20230731143432.58886-1-nks@flawful.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Niklas Cassel The TODO claims that the pdc_20621_ops should set the .inherits function pointer to &ata_base_port_ops after it has been converted to use the new EH. However, the driver was converted to use the new EH a long time ago, in commit 67651ee5710c ("[libata] sata_sx4: convert to new exception handling methods"), which also did set .inherits function pointer to &ata_sff_port_ops (and ata_sff_port_ops itself has .inherits set to &ata_base_port_ops). Signed-off-by: Niklas Cassel Reviewed-by: Hannes Reinecke Reviewed-by: Jason Yan Reviewed-by: John Garry --- drivers/ata/sata_sx4.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index ccc016072637..b51d7a9d0d90 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c @@ -232,7 +232,6 @@ static const struct scsi_host_template pdc_sata_sht = { .dma_boundary = ATA_DMA_BOUNDARY, }; -/* TODO: inherit from base port_ops after converting to new EH */ static struct ata_port_operations pdc_20621_ops = { .inherits = &ata_sff_port_ops, From patchwork Mon Jul 31 14:34:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 708694 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 846ACC00528 for ; Mon, 31 Jul 2023 14:40:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232561AbjGaOkS (ORCPT ); Mon, 31 Jul 2023 10:40:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232554AbjGaOkO (ORCPT ); Mon, 31 Jul 2023 10:40:14 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0487011C; Mon, 31 Jul 2023 07:40:13 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-4f4b2bc1565so7215722e87.2; Mon, 31 Jul 2023 07:40:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690814411; x=1691419211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VJOGtTDREfbV8OYpGif0IKD7eMnTiyh+wZE8SJ1ImCI=; b=cNSjNj4TnYlhcTi3xouSskMSZkWwG28ZipgcJ4tRxSGOIl+IUG9TVszOuTjD1vFpeh O9gF6DUH756LGCfHH/kny62IyFsCdwDsp2IAbXWNmSaEYUlPgDlNGdojjpslFjSG3JXG 6/w5HakhnDtot5Us3vjGBVhn9z600IhDizoO2APwMBPj5/qFTfOZzRiCpSEI6Vn8iMrz bN3HfRymqY9Qpmo5QQocrr915rZWW2SPxq0XSG3L6fgDphdgu2MAl6RutGhUPsPUFqV6 tKbevv0lutWZFlR6QZcgQ4QMbkdQ6TwTpkTI7QSReV9ao52UGWSJcdYMbtp3Fp4h+eGR 340w== X-Gm-Message-State: ABy/qLafQ1QhgD7AtxclpprEh/lmS+V74agO0XpuiffIlEwDtSDnSHaH iiarSDIlZLAkLwSqiPiVw8fhK3c9KlXHtg== X-Google-Smtp-Source: APBJJlFZQpXB0q9uKF/n7yxQlHVnmrQO5djcx6klaX9eq3nTGkfY0Vt1eBwKybR5SAy+QAtTX0T87g== X-Received: by 2002:a05:6512:3254:b0:4fe:1a99:45e3 with SMTP id c20-20020a056512325400b004fe1a9945e3mr10901lfr.30.1690814411006; Mon, 31 Jul 2023 07:40:11 -0700 (PDT) Received: from flawful.org (c-f5f0e255.011-101-6d6c6d3.bbcust.telenor.se. [85.226.240.245]) by smtp.gmail.com with ESMTPSA id q17-20020ac25fd1000000b004fb7cd9651bsm2094755lfg.98.2023.07.31.07.40.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:40:10 -0700 (PDT) Received: by flawful.org (Postfix, from userid 112) id B54A13F16; Mon, 31 Jul 2023 16:40:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814409; bh=Rbfs5epaggzjkrl275wlRpsTZE3RxtYbUO+5BZIP0PM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j1ca/4R2PLjU5eeI0AaZZu0xFEGHEUduOLqzHwYWL/wpDyFrDVH7gtZRPPKM3Q5aK zs+1VM2iFQELyDGw7BtPyFpoOJPlEyRed5uG0BnmGFe4ufC63qykKtZpBy4SC6xteH gMZ+P1s/AKM0BP9Ea6PFDByqnt8Pq+trz0vdt5w0= Received: from x1-carbon.lan (OpenWrt.lan [192.168.1.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by flawful.org (Postfix) with ESMTPSA id C264241D1; Mon, 31 Jul 2023 16:35:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814103; bh=Rbfs5epaggzjkrl275wlRpsTZE3RxtYbUO+5BZIP0PM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=djTkIUhCcYKh3DLkvJ1A+mR4Q0KRHUptDeuRaNvJ1+bVnrcWQ5/jPB2c6os6s68Ap vUX5V4PPspfNQDBWs4wOyHdtan5wd5/HuhyHJCl/qS8f2jUvYS5GXj8Tfb3BxzkAi9 IJ0M9bO3PF/lQPvIvQJLNUwhwjFA3BR8Hx0OgEx4= From: Niklas Cassel To: Damien Le Moal , Jonathan Corbet Cc: Hannes Reinecke , John Garry , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Niklas Cassel , Jason Yan , linux-doc@vger.kernel.org Subject: [PATCH v4 09/10] ata: remove ata_bus_probe() Date: Mon, 31 Jul 2023 16:34:20 +0200 Message-ID: <20230731143432.58886-10-nks@flawful.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731143432.58886-1-nks@flawful.org> References: <20230731143432.58886-1-nks@flawful.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Niklas Cassel Remove ata_bus_probe() as it is unused. Also, remove references to ata_bus_probe and port_disable in Documentation/driver-api/libata.rst, as neither exist anymore. Signed-off-by: Niklas Cassel Reviewed-by: John Garry Reviewed-by: Jason Yan --- Documentation/driver-api/libata.rst | 16 ---- drivers/ata/libata-core.c | 138 ---------------------------- drivers/ata/libata.h | 1 - include/linux/libata.h | 1 - 4 files changed, 156 deletions(-) diff --git a/Documentation/driver-api/libata.rst b/Documentation/driver-api/libata.rst index 311af516a3fd..eecb8b81e185 100644 --- a/Documentation/driver-api/libata.rst +++ b/Documentation/driver-api/libata.rst @@ -32,22 +32,6 @@ register blocks. :c:type:`struct ata_port_operations ` ---------------------------------------------------------- -Disable ATA port -~~~~~~~~~~~~~~~~ - -:: - - void (*port_disable) (struct ata_port *); - - -Called from :c:func:`ata_bus_probe` error path, as well as when unregistering -from the SCSI module (rmmod, hot unplug). This function should do -whatever needs to be done to take the port out of use. In most cases, -:c:func:`ata_port_disable` can be used as this hook. - -Called from :c:func:`ata_bus_probe` on a failed probe. Called from -:c:func:`ata_scsi_release`. - Post-IDENTIFY device configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 25a228350c75..53335f513cdf 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -3057,144 +3057,6 @@ int ata_cable_sata(struct ata_port *ap) } EXPORT_SYMBOL_GPL(ata_cable_sata); -/** - * ata_bus_probe - Reset and probe ATA bus - * @ap: Bus to probe - * - * Master ATA bus probing function. Initiates a hardware-dependent - * bus reset, then attempts to identify any devices found on - * the bus. - * - * LOCKING: - * PCI/etc. bus probe sem. - * - * RETURNS: - * Zero on success, negative errno otherwise. - */ - -int ata_bus_probe(struct ata_port *ap) -{ - unsigned int classes[ATA_MAX_DEVICES]; - int tries[ATA_MAX_DEVICES]; - int rc; - struct ata_device *dev; - - ata_for_each_dev(dev, &ap->link, ALL) - tries[dev->devno] = ATA_PROBE_MAX_TRIES; - - retry: - ata_for_each_dev(dev, &ap->link, ALL) { - /* If we issue an SRST then an ATA drive (not ATAPI) - * may change configuration and be in PIO0 timing. If - * we do a hard reset (or are coming from power on) - * this is true for ATA or ATAPI. Until we've set a - * suitable controller mode we should not touch the - * bus as we may be talking too fast. - */ - dev->pio_mode = XFER_PIO_0; - dev->dma_mode = 0xff; - - /* If the controller has a pio mode setup function - * then use it to set the chipset to rights. Don't - * touch the DMA setup as that will be dealt with when - * configuring devices. - */ - if (ap->ops->set_piomode) - ap->ops->set_piomode(ap, dev); - } - - /* reset and determine device classes */ - ap->ops->phy_reset(ap); - - ata_for_each_dev(dev, &ap->link, ALL) { - if (dev->class != ATA_DEV_UNKNOWN) - classes[dev->devno] = dev->class; - else - classes[dev->devno] = ATA_DEV_NONE; - - dev->class = ATA_DEV_UNKNOWN; - } - - /* read IDENTIFY page and configure devices. We have to do the identify - specific sequence bass-ackwards so that PDIAG- is released by - the slave device */ - - ata_for_each_dev(dev, &ap->link, ALL_REVERSE) { - if (tries[dev->devno]) - dev->class = classes[dev->devno]; - - if (!ata_dev_enabled(dev)) - continue; - - rc = ata_dev_read_id(dev, &dev->class, ATA_READID_POSTRESET, - dev->id); - if (rc) - goto fail; - } - - /* Now ask for the cable type as PDIAG- should have been released */ - if (ap->ops->cable_detect) - ap->cbl = ap->ops->cable_detect(ap); - - /* We may have SATA bridge glue hiding here irrespective of - * the reported cable types and sensed types. When SATA - * drives indicate we have a bridge, we don't know which end - * of the link the bridge is which is a problem. - */ - ata_for_each_dev(dev, &ap->link, ENABLED) - if (ata_id_is_sata(dev->id)) - ap->cbl = ATA_CBL_SATA; - - /* After the identify sequence we can now set up the devices. We do - this in the normal order so that the user doesn't get confused */ - - ata_for_each_dev(dev, &ap->link, ENABLED) { - ap->link.eh_context.i.flags |= ATA_EHI_PRINTINFO; - rc = ata_dev_configure(dev); - ap->link.eh_context.i.flags &= ~ATA_EHI_PRINTINFO; - if (rc) - goto fail; - } - - /* configure transfer mode */ - rc = ata_set_mode(&ap->link, &dev); - if (rc) - goto fail; - - ata_for_each_dev(dev, &ap->link, ENABLED) - return 0; - - return -ENODEV; - - fail: - tries[dev->devno]--; - - switch (rc) { - case -EINVAL: - /* eeek, something went very wrong, give up */ - tries[dev->devno] = 0; - break; - - case -ENODEV: - /* give it just one more chance */ - tries[dev->devno] = min(tries[dev->devno], 1); - fallthrough; - case -EIO: - if (tries[dev->devno] == 1) { - /* This is the last chance, better to slow - * down than lose it. - */ - sata_down_spd_limit(&ap->link, 0); - ata_down_xfermask_limit(dev, ATA_DNXFER_PIO); - } - } - - if (!tries[dev->devno]) - ata_dev_disable(dev); - - goto retry; -} - /** * sata_print_link_status - Print SATA link status * @link: SATA link to printk link status about diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index 1ec9b4427b84..6e7d352803bd 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h @@ -122,7 +122,6 @@ extern void ata_scsi_media_change_notify(struct ata_device *dev); extern void ata_scsi_hotplug(struct work_struct *work); extern void ata_schedule_scsi_eh(struct Scsi_Host *shost); extern void ata_scsi_dev_rescan(struct work_struct *work); -extern int ata_bus_probe(struct ata_port *ap); extern int ata_scsi_user_scan(struct Scsi_Host *shost, unsigned int channel, unsigned int id, u64 lun); void ata_scsi_sdev_config(struct scsi_device *sdev); diff --git a/include/linux/libata.h b/include/linux/libata.h index 05d2fc0df553..049159905a28 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -344,7 +344,6 @@ enum { ATA_LINK_RESUME_TRIES = 5, /* how hard are we gonna try to probe/recover devices */ - ATA_PROBE_MAX_TRIES = 3, ATA_EH_DEV_TRIES = 3, ATA_EH_PMP_TRIES = 5, ATA_EH_PMP_LINK_TRIES = 3, From patchwork Mon Jul 31 14:34:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Cassel X-Patchwork-Id: 709509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14A4FC001E0 for ; Mon, 31 Jul 2023 14:40:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232593AbjGaOkQ (ORCPT ); Mon, 31 Jul 2023 10:40:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232547AbjGaOkM (ORCPT ); Mon, 31 Jul 2023 10:40:12 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3272411B; Mon, 31 Jul 2023 07:40:11 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-4fe07f0636bso7408256e87.1; Mon, 31 Jul 2023 07:40:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690814409; x=1691419209; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KIcJ+DY3XhMKETlUOqbLoo1KBmrfR4L+ppXQy9TiybY=; b=bFrZb4Z/FRUqbtue3Y+DlLb1h1KKltes1ux9peFukrSYQ2xeIkPul8DIeiS+FcE9lH jtWgfUCQUOomA3zRIT3NVXvGNYKCkC/EwfzQeGSenYifgPHBWaFJTgVGKMEZ0ce+y1bB zIwOFPCKn+2+Jo5lvGolRF5/sFr8AtXWk6e8TBffmP39t+US/kKNKTD3YdGfaKtfCMQA 31TJBuHaTEP20dzXwGcoShkEw47RGiG+yLPOm1Yxm05hU9+wZPLG3Jw+rUVtwXCBl8lL KrfaoiKtFdF+GAKqluzDiQvkYlDTJlVh9Fcgs66B9yb1MBEmBgMI5GEr4syM6sO9x2T5 tgKA== X-Gm-Message-State: ABy/qLY6e7mSO98a0jVHPXfzSlrqCwp3k2ttQpNzG5Xfl7RAdBznM5Dr 0YyHrSqs4Z8yFmr8aG2gTeLIjmoJswSX8g== X-Google-Smtp-Source: APBJJlHnyjEPfM97oZA/PBYKRALe+VOrckMFRUITH2pYSAXDSoQbz2pW1+SpRj8uVg5J49X8Q98zyQ== X-Received: by 2002:ac2:504d:0:b0:4fe:82c:5c8a with SMTP id a13-20020ac2504d000000b004fe082c5c8amr2823lfm.58.1690814409202; Mon, 31 Jul 2023 07:40:09 -0700 (PDT) Received: from flawful.org (c-f5f0e255.011-101-6d6c6d3.bbcust.telenor.se. [85.226.240.245]) by smtp.gmail.com with ESMTPSA id w3-20020ac24423000000b004fe1f02db22sm1719645lfl.186.2023.07.31.07.40.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 07:40:08 -0700 (PDT) Received: by flawful.org (Postfix, from userid 112) id E90CE3F6E; Mon, 31 Jul 2023 16:40:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814408; bh=edDMj8QumS1e68jpdMyw7e897DoL0c2jDNcs9yDf72g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eeZmWMPqvK2vQiM76FVe7Ffv+XblGp3w968KUIPkyAO5CnfP3Hg5QBizHaw9kPqX/ eourhuX0vNP3g8/UVHDUbB4EcXvtoevX5VaNvl2Reb1/IM6wpGl7NHPADr76TtlwC1 Mwvryww13FLsquxKcF6sOmWB2W6ZZOxBZ7/n6IWE= Received: from x1-carbon.lan (OpenWrt.lan [192.168.1.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by flawful.org (Postfix) with ESMTPSA id D440657C0; Mon, 31 Jul 2023 16:35:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=flawful.org; s=mail; t=1690814104; bh=edDMj8QumS1e68jpdMyw7e897DoL0c2jDNcs9yDf72g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NmYfmLEj/FOULU54oOsnSNCfgS93+RAYDd9H3fxC+SkAw5t0isGIJB/8SyOVVUifH uz4qIxHicsgmX7z8it/zlhc1DZRLSu6jg6Zvs+fLIJjZgk++KSDaMlIj6GyqSWmuHq sVNLZ0v1d02BNmfJGr8qzxiTg++wzGUbDg9nx4yA= From: Niklas Cassel To: Damien Le Moal , Jonathan Corbet , Sergey Shtylyov Cc: Hannes Reinecke , John Garry , linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Niklas Cassel , Jason Yan , linux-doc@vger.kernel.org Subject: [PATCH v4 10/10] ata: remove deprecated EH callbacks Date: Mon, 31 Jul 2023 16:34:21 +0200 Message-ID: <20230731143432.58886-11-nks@flawful.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230731143432.58886-1-nks@flawful.org> References: <20230731143432.58886-1-nks@flawful.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Niklas Cassel Now when all libata drivers have migrated to use the error_handler callback, remove the deprecated phy_reset and eng_timeout callbacks. Also remove references to non-existent functions sata_phy_reset and ata_qc_timeout from Documentation/driver-api/libata.rst. Signed-off-by: Niklas Cassel Reviewed-by: John Garry Reviewed-by: Sergey Shtylyov Reviewed-by: Jason Yan --- Documentation/driver-api/libata.rst | 22 ++++++---------------- drivers/ata/pata_sl82c105.c | 3 +-- include/linux/libata.h | 6 ------ 3 files changed, 7 insertions(+), 24 deletions(-) diff --git a/Documentation/driver-api/libata.rst b/Documentation/driver-api/libata.rst index eecb8b81e185..5da27a749246 100644 --- a/Documentation/driver-api/libata.rst +++ b/Documentation/driver-api/libata.rst @@ -256,14 +256,6 @@ advanced drivers implement their own ``->qc_issue``. Exception and probe handling (EH) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -:: - - void (*eng_timeout) (struct ata_port *ap); - void (*phy_reset) (struct ata_port *ap); - - -Deprecated. Use ``->error_handler()`` instead. - :: void (*freeze) (struct ata_port *ap); @@ -348,8 +340,7 @@ SATA phy read/write u32 val); -Read and write standard SATA phy registers. Currently only used if -``->phy_reset`` hook called the :c:func:`sata_phy_reset` helper function. +Read and write standard SATA phy registers. sc_reg is one of SCR_STATUS, SCR_CONTROL, SCR_ERROR, or SCR_ACTIVE. Init and shutdown @@ -520,13 +511,12 @@ to return without deallocating the qc. This leads us to :c:func:`ata_scsi_error` is the current ``transportt->eh_strategy_handler()`` for libata. As discussed above, this will be entered in two cases - -timeout and ATAPI error completion. This function calls low level libata -driver's :c:func:`eng_timeout` callback, the standard callback for which is -:c:func:`ata_eng_timeout`. It checks if a qc is active and calls -:c:func:`ata_qc_timeout` on the qc if so. Actual error handling occurs in -:c:func:`ata_qc_timeout`. +timeout and ATAPI error completion. This function will check if a qc is active +and has not failed yet. Such a qc will be marked with AC_ERR_TIMEOUT such that +EH will know to handle it later. Then it calls low level libata driver's +:c:func:`error_handler` callback. -If EH is invoked for timeout, :c:func:`ata_qc_timeout` stops BMDMA and +When the :c:func:`error_handler` callback is invoked it stops BMDMA and completes the qc. Note that as we're currently in EH, we cannot call scsi_done. As described in SCSI EH doc, a recovered scmd should be either retried with :c:func:`scsi_queue_insert` or finished with diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c index 3b62ea482f1a..93882e976ede 100644 --- a/drivers/ata/pata_sl82c105.c +++ b/drivers/ata/pata_sl82c105.c @@ -180,8 +180,7 @@ static void sl82c105_bmdma_start(struct ata_queued_cmd *qc) * document. * * This function is also called to turn off DMA when a timeout occurs - * during DMA operation. In both cases we need to reset the engine, - * so no actual eng_timeout handler is required. + * during DMA operation. In both cases we need to reset the engine. * * We assume bmdma_stop is always called if bmdma_start as called. If * not then we may need to wrap qc_issue. diff --git a/include/linux/libata.h b/include/linux/libata.h index 049159905a28..7a9cbc28472d 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -975,12 +975,6 @@ struct ata_port_operations { ssize_t (*transmit_led_message)(struct ata_port *ap, u32 state, ssize_t size); - /* - * Obsolete - */ - void (*phy_reset)(struct ata_port *ap); - void (*eng_timeout)(struct ata_port *ap); - /* * ->inherits must be the last field and all the preceding * fields must be pointers.