From patchwork Mon Aug 3 08:57:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Hsiung Wang X-Patchwork-Id: 11697615 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B960138C for ; Mon, 3 Aug 2020 08:57:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 329E220719 for ; Mon, 3 Aug 2020 08:57:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="GEKOq4tq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726279AbgHCI5k (ORCPT ); Mon, 3 Aug 2020 04:57:40 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:34318 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725806AbgHCI5k (ORCPT ); Mon, 3 Aug 2020 04:57:40 -0400 X-UUID: 96cee2b537f1408297909ca48114b1b5-20200803 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=ERSI7lvLnv/tu/AUYaGM8CHfyvlRJpUTDWsBR5j2Xvw=; b=GEKOq4tqqwW6xqawGaHXbMe+hHC8exyqRuyublY1HCUObDpmnSVWMDAd+BWB52HClfd1yKR+5/qR7vVfq11eAxXUKJcXbv8qJO0Z/kDRIWuOv3eVmD9OylJ4eWaeoslnoa9PIxffOUcorgcZMzfYjQ6+5jRaRKjfb9qq/sTHwPM=; X-UUID: 96cee2b537f1408297909ca48114b1b5-20200803 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 160316854; Mon, 03 Aug 2020 16:57:38 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 3 Aug 2020 16:57:35 +0800 Received: from mtksdaap41.mediatek.inc (172.21.77.4) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 3 Aug 2020 16:57:35 +0800 From: Hsin-Hsiung Wang To: Mark Brown , Rob Herring , Matthias Brugger CC: Liam Girdwood , Stephen Boyd , Hsin-Hsiung Wang , , , , , , Subject: [PATCH 1/3] spmi: Add driver shutdown support Date: Mon, 3 Aug 2020 16:57:25 +0800 Message-ID: <1596445047-2975-2-git-send-email-hsin-hsiung.wang@mediatek.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1596445047-2975-1-git-send-email-hsin-hsiung.wang@mediatek.com> References: <1596445047-2975-1-git-send-email-hsin-hsiung.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add new shutdown() method. Use it in the standard driver model style. Signed-off-by: Hsin-Hsiung Wang --- drivers/spmi/spmi.c | 12 ++++++++++++ drivers/spmi/spmi.c | 12 ++++++++++++ include/linux/spmi.h | 1 + 2 files changed, 13 insertions(+) diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c index c16b60f..5fde024 100644 --- a/drivers/spmi/spmi.c +++ b/drivers/spmi/spmi.c @@ -357,6 +357,17 @@ static int spmi_drv_remove(struct device *dev) return 0; } +static void spmi_drv_shutdown(struct device *dev) +{ + const struct spmi_driver *sdrv = to_spmi_driver(dev->driver); + + if (!sdrv) + return; + + + if (sdrv->shutdown) + sdrv->shutdown(to_spmi_device(dev)); +} +} + static int spmi_drv_uevent(struct device *dev, struct kobj_uevent_env *env) { int ret; @@ -373,6 +384,7 @@ static struct bus_type spmi_bus_type = { @@ -373,6 +384,7 @@ static struct bus_type spmi_bus_type = { .match = spmi_device_match, .probe = spmi_drv_probe, .remove = spmi_drv_remove, + .shutdown = spmi_drv_shutdown, .uevent = spmi_drv_uevent, }; diff --git a/include/linux/spmi.h b/include/linux/spmi.h index 394a3f6..729bcbf 100644 --- a/include/linux/spmi.h +++ b/include/linux/spmi.h @@ -138,6 +138,7 @@ struct spmi_driver { struct device_driver driver; int (*probe)(struct spmi_device *sdev); void (*remove)(struct spmi_device *sdev); + void (*shutdown)(struct spmi_device *sdev); }; static inline struct spmi_driver *to_spmi_driver(struct device_driver *d)