From patchwork Fri Apr 5 11:08:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 161836 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp298019jan; Fri, 5 Apr 2019 04:09:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWCfAL8anQ8vrOKEbOUauS70vdn0Hc3UBJn36mvRQtnS1bFDfQoqf8HKRYGjagQR837kIU X-Received: by 2002:a63:5a1d:: with SMTP id o29mr11347565pgb.320.1554462587910; Fri, 05 Apr 2019 04:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554462587; cv=none; d=google.com; s=arc-20160816; b=Vq/j5MkYj4KvbXISZ3imQQsFnmKfTVuuSgoJpcIkNjjMTdxxM49up6nbkOdXNUDfAu JmnEpxbS1yYTDpC19xGsCmEuSfa89ZLDpf264iq2h7jwxSHz/OvDB7j1YpngpD/IR/US NoZ6ZOO104KCgYL6igzUYV2gkZGg+a+y1rfobRRgCNnefRuwjlsR6s7KqTQJc4hNyKGt t9iyxQh/VPZADU8ekV1IjIiTJJePY5EvUEmsAe/+6xHgfbW4StzyYAMWkYzI4jp2u9nN 3jn9GLYxCy/hXnVoGRCf0JBxgHCOkXWH0Uf0MZKYRy8oV4lmUVQRD4Oz86irYbHWmAUi xSYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=uf3kjAaOPFCPxUbTLMm7tK0cexSLaZI+4gMmasE/zBA=; b=SOHVDa9ff/jzqlPJbwNiFLvSv5cfjEHUg7uQTrMSEzSohEPQrFNxYFblmTN0JYZxj8 6AbkbMtjkUeVDQ1/fhdU9A6rLLnV/EWoq++SbjizTqSM0SQ5rfchEWzt6/y57D/PF+PM W0osaGpIRfvn+eOR12E5a7rF/g7RNGtf00idG3MwhmZCTlwXzcYzUh8c/KnUhUakRbgl yXeK6U6mzXfMxt8ZTKGv2hWGC46uRqQf+24Nw4BweqDHIRqE3DMNJnvPQ5Nd/2JKLI83 vWn+T6VPu1n/Juwcm6iHLI5L+RxNMJchshT4HFK2fqMvvJHIRL3H3c7AWxg4v8Bi7g2u 5TGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="A7RG/o+6"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si17818452pgv.418.2019.04.05.04.09.47; Fri, 05 Apr 2019 04:09:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="A7RG/o+6"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730886AbfDELJq (ORCPT + 31 others); Fri, 5 Apr 2019 07:09:46 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:38488 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730497AbfDELJp (ORCPT ); Fri, 5 Apr 2019 07:09:45 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x35B9fst045330; Fri, 5 Apr 2019 06:09:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1554462581; bh=uf3kjAaOPFCPxUbTLMm7tK0cexSLaZI+4gMmasE/zBA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=A7RG/o+6qLPiouMf9ms10RcnWIncfVTvp6VDvYAxVlu+v6WysLYoyvmn4hLcRTvfL Q5/1s09ndi8EGB5dv6cc2xBCYiFbj82e4VIaB5mmK4BoNccGo0+hmpjLhE5ePB6GuG QfZtprTpY2VQNK9n3NCGNDuMn4diQvWx7OR3tjxQ= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x35B9fkW029475 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 5 Apr 2019 06:09:41 -0500 Received: from DFLE108.ent.ti.com (10.64.6.29) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 5 Apr 2019 06:09:40 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE108.ent.ti.com (10.64.6.29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 5 Apr 2019 06:09:40 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x35B9aS1100251; Fri, 5 Apr 2019 06:09:39 -0500 From: Kishon Vijay Abraham I To: Rob Herring , Kishon Vijay Abraham I , CC: Mark Rutland , , Subject: [PATCH v4 1/5] phy: core: Add *release* phy_ops invoked when the consumer relinquishes PHY Date: Fri, 5 Apr 2019 16:38:30 +0530 Message-ID: <20190405110834.13083-2-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190405110834.13083-1-kishon@ti.com> References: <20190405110834.13083-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new phy_ops *release* invoked when the consumer relinquishes the PHY using phy_put/devm_phy_put. The initializations done by the PHY driver in of_xlate call back can be can be cleaned up here. Signed-off-by: Kishon Vijay Abraham I --- drivers/phy/phy-core.c | 5 +++++ include/linux/phy/phy.h | 2 ++ 2 files changed, 7 insertions(+) -- 2.17.1 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index cb38f6e8614c..b9a4ebf35dd3 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -564,6 +564,11 @@ void phy_put(struct phy *phy) if (!phy || IS_ERR(phy)) return; + mutex_lock(&phy->mutex); + if (phy->ops->release) + phy->ops->release(phy); + mutex_unlock(&phy->mutex); + module_put(phy->ops->owner); put_device(&phy->dev); } diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 3f350e2749fe..ef13aea1d370 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -64,6 +64,7 @@ union phy_configure_opts { * @set_mode: set the mode of the phy * @reset: resetting the phy * @calibrate: calibrate the phy + * @release: ops to be performed while the consumer relinquishes the PHY * @owner: the module owner containing the ops */ struct phy_ops { @@ -105,6 +106,7 @@ struct phy_ops { union phy_configure_opts *opts); int (*reset)(struct phy *phy); int (*calibrate)(struct phy *phy); + void (*release)(struct phy *phy); struct module *owner; };