From patchwork Fri Sep 25 16:19:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Asleson X-Patchwork-Id: 1371428 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SqNm+aGH; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4BycZ91J1Rz9sTQ for ; Sat, 26 Sep 2020 02:19:45 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729477AbgIYQTm (ORCPT ); Fri, 25 Sep 2020 12:19:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:41617 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729480AbgIYQTl (ORCPT ); Fri, 25 Sep 2020 12:19:41 -0400 Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601050780; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ANY2qnzvW5slLXQEnRPDZ8OvNs0Obq0WqgEdDcyBR9E=; b=SqNm+aGHT+MjCTZlVVu6PuHNKga/WjKNW0ip0hmQkmOBSZnbgFsEHbFh2W+zcZL5KerlAb D9eWs6m1QSYj+sAGFq5FGZu3F50wgtphplF936pNU2h0sbSGw+fMRpeAl7IZiREsrfS4Oh WoII4Wv5DzeHYvXN+m7qrminNVE3zSc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-582-Xdn-GAWHPDq-o_t1u0PIGQ-1; Fri, 25 Sep 2020 12:19:38 -0400 X-MC-Unique: Xdn-GAWHPDq-o_t1u0PIGQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D93E210BBED2; Fri, 25 Sep 2020 16:19:37 +0000 (UTC) Received: from sulaco.redhat.com (unknown [10.10.110.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 162515D9DC; Fri, 25 Sep 2020 16:19:36 +0000 (UTC) From: Tony Asleson To: linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, linux-ide@vger.kernel.org Subject: [v5 06/12] libata: Add ata_scsi_durable_name Date: Fri, 25 Sep 2020 11:19:23 -0500 Message-Id: <20200925161929.1136806-7-tasleson@redhat.com> In-Reply-To: <20200925161929.1136806-1-tasleson@redhat.com> References: <20200925161929.1136806-1-tasleson@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Function used to create the durable name for ata scsi. Signed-off-by: Tony Asleson --- drivers/ata/libata-scsi.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 46336084b1a9..194dac7dbdca 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -1086,6 +1086,13 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev) return 0; } +int ata_scsi_durable_name(const struct device *dev, char *buf, size_t len) +{ + struct ata_device *ata_dev = container_of(dev, struct ata_device, tdev); + + return scsi_durable_name(ata_dev->sdev, buf, len); +} + /** * ata_scsi_slave_config - Set SCSI device attributes * @sdev: SCSI device to examine @@ -1102,14 +1109,19 @@ int ata_scsi_slave_config(struct scsi_device *sdev) { struct ata_port *ap = ata_shost_to_port(sdev->host); struct ata_device *dev = __ata_scsi_find_dev(ap, sdev); - int rc = 0; + int rc; ata_scsi_sdev_config(sdev); - if (dev) + if (dev) { rc = ata_scsi_dev_config(sdev, dev); + if (rc) + return rc; - return rc; + dev->tdev.durable_name = ata_scsi_durable_name; + } + + return 0; } EXPORT_SYMBOL_GPL(ata_scsi_slave_config);