From patchwork Wed Feb 6 11:07:50 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: 157617 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp6277034jaa; Wed, 6 Feb 2019 03:08:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IbiX+/Hf6MPV81vg6VymWJj28jvCasgpSfGDG070604mFfUXeMaTS7oM3z6032oXnrhYAXU X-Received: by 2002:a63:1c53:: with SMTP id c19mr9165895pgm.296.1549451322745; Wed, 06 Feb 2019 03:08:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549451322; cv=none; d=google.com; s=arc-20160816; b=pl3NTxAIhwGa7hEUOAJrGG+hfNcZ8439ylEu8t5l2SalI685eS06BxFt3DdsWTXeIB hsXaDDPg094mwK8JZGg8WK0G9JVYSMtBG8ibqTBnHgx5p67GJMhDvkDW4c1MMXk2FmQm KerK1vrvktk1/stb+cjlIP6DiWnDhXbWZ4/P2trhw5TVRr0Y7Gv3I+id5vf6+EX9pc5t 4omGwmBnpklt73LKkS/wjeuxtzFlfFqkZ+FjwpIAi0C4Cg9p55GprM0F/8PTFRQDwst0 rNl6ROMAWxSdFUO64sQl4wW8Y4z6BtYgBpmttM9P1RcYuGFk+MDdSXPHfy3ykoSwct9W Djfg== 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=JcIZCr2ZoDLLnRrlQJdSZpB3Xsnkta8Ze+j4FMA3BL0=; b=vdcgTp3HtNgJyj1qhKpS7RJyFncOokToNGu1rGy2T0p3yYlVZCv2+hXj/OZvPOeyuK zWrnoaVeV7JmEfRwX42+Zad19WDBxLMvJk35XrTImwYv1nuz/59JBMeWcAPep1CpJNUC Z9HewTHDfsag3MhOE38DqNQRw04ADv6dDGmgVI7jQEOSG6A8JouME6Z6L3j3902XnMAa aBR9c/Upt7Yy7N6NGwW+kpP21aNGN4I763JeDU1Quy5iHsb25QTRtHMQ0uWesckAndcK AjnAlTZkJddIpRTc0d7txiAEhng2EaeQK4TyTHABAic93PD1p9XppkHplREcGQU/OG1C Y61w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=Vquy3WCO; 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 h91si5688201pld.411.2019.02.06.03.08.42; Wed, 06 Feb 2019 03:08:42 -0800 (PST) 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=Vquy3WCO; 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 S1729644AbfBFLIl (ORCPT + 31 others); Wed, 6 Feb 2019 06:08:41 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:33516 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726708AbfBFLIj (ORCPT ); Wed, 6 Feb 2019 06:08:39 -0500 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x16B8bw7103484; Wed, 6 Feb 2019 05:08:37 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1549451317; bh=JcIZCr2ZoDLLnRrlQJdSZpB3Xsnkta8Ze+j4FMA3BL0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Vquy3WCOAHbGiOAM6abAhmZgQkiwMmrHl3IDdFMnE7Num/Q1BVYj2fWlpjwsSh+Qi i0hiNBDUhSy6Ut3lGTAjQwmgtwRiHmzOaPVhVzcOnVwyQ+prE/YM+Kj8o4gCor/LFh 8FWBp0vF0HnunKJ6nZVMzs9dluyR6j7U0IorBELY= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x16B8b7Y111780 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 6 Feb 2019 05:08:37 -0600 Received: from DLEE108.ent.ti.com (157.170.170.38) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 6 Feb 2019 05:08:37 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Wed, 6 Feb 2019 05:08:36 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x16B8WaZ024645; Wed, 6 Feb 2019 05:08:35 -0600 From: Kishon Vijay Abraham I To: Kishon Vijay Abraham I , Rob Herring CC: Roger Quadros , , Subject: [PATCH v2 1/4] phy: core: Add *release* phy_ops invoked when the consumer relinquishes PHY Date: Wed, 6 Feb 2019 16:37:50 +0530 Message-ID: <20190206110753.28738-2-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190206110753.28738-1-kishon@ti.com> References: <20190206110753.28738-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 19b05e824ee4..d4bd85afdc91 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 e8e118d70fd7..feb8dce54ac2 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -63,6 +63,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 reliquishes the PHY * @owner: the module owner containing the ops */ struct phy_ops { @@ -104,6 +105,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; };