Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2514925pxa; Mon, 3 Aug 2020 18:58:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgr3umw2mi/jLaKKVrJoyj79gl+ImslhcwDmqgOlm2zEIJCl5cPyjYeqRXIXURpBvvSLNL X-Received: by 2002:a17:906:a182:: with SMTP id s2mr12752994ejy.526.1596506307124; Mon, 03 Aug 2020 18:58:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596506307; cv=none; d=google.com; s=arc-20160816; b=Q6JY+mva3anf3473gdfhSr/6bdTlZsHlpB/CWXU9K8EoKPmJLD50vn7OuLH1NCnGtc 73pmooY/7GtBvkEgspZxNmTc3asf7Vn17gv7f0VQ5o9wgZ33h1ySOT+c7Pao8dU8j6+n EjqCPe2AJDNnuXYsYnvjMMO+GgKnJKbSpjfsEXFLOqQtpW2wqdIV/SwazXtkLmx1vgEP pG2W/VbJE0R/1SWikyE9z9aQE0tAWQMMvLqydsI2q7fMCD670EtuSqBN3Wr4poYP2mKh EX8E5Gw4PgweTcR7TCe1nQZRw3kLEvO43fEY46kIxhf7fs9FF2IA2VPG8jk0vrdQsZ/g L+sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ZjddNGXz3YzU7Pvdk0bKn7EGChBBYHNzVV19el9GvN4=; b=Ex5/q7bv8QbvgSfrmac64mScSmN7GbK7w9KCuq54Ms9+VOBb0tx5qwamyePF3NcCFr hc7jCMxaAUUaB4aN2+NmhEA3sqfvFLNAB4ZDzX0feNzJ2ACt7h8i+IWCy0pXHhuCWCB6 fG5vplmLzffBX6gDnWjvgsAVJ24lx0eHcEebQozDEDxaeP+h/8TVniahcoG5XtDYyh8j zW815hMnrq5zzzH8pfrdHl+yyhq7g0hNCld1Kym0YPcaH+AebbLkAhECLDP08SOq4eD6 mB6aR8tdp08bE7ipTbT9sqDQAzOIUHhoskZ0VnzRZ8naYNMZn7csK7zo9YNegv9HNEs8 w4Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aaf257HY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g1si862935ejf.433.2020.08.03.18.58.02; Mon, 03 Aug 2020 18:58:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aaf257HY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727083AbgHDBvP (ORCPT + 99 others); Mon, 3 Aug 2020 21:51:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726615AbgHDBvP (ORCPT ); Mon, 3 Aug 2020 21:51:15 -0400 Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 233DBC061756 for ; Mon, 3 Aug 2020 18:51:14 -0700 (PDT) Received: by mail-vs1-xe42.google.com with SMTP id j186so20254363vsd.10 for ; Mon, 03 Aug 2020 18:51:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZjddNGXz3YzU7Pvdk0bKn7EGChBBYHNzVV19el9GvN4=; b=aaf257HYCPeWHrjBXePaOYS8VFb1Q/czqyneX50WCTw9iwZoobQcG+o1I1MWB7iKJs smazrjiW0L6F2JZ72ElWTxCb5NTLzF2eL/KqMeWC9AHOwb9tlBgjdHwOTBLnOa+PAG0y GzfieF4oG1m72F66pbXCb9LhKUeoz73OImW5s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZjddNGXz3YzU7Pvdk0bKn7EGChBBYHNzVV19el9GvN4=; b=JZYuRO/bhn6PUpM66cVLOUiqRQ9jEz5l0gF74P/2MR1hxAa4FABe2HNz7x9c/hbthF Htm1vDs9kLBsmd8UYioj8MOr7LvYzVVPwjqqazCjU3lUrNde5xHYBq8XqZncJiR/BClG Q6KqFTDlAbWmxqM/T50ldHZGNDzbc98QgeXzK5n1dSLnipdoLFF/iqq2ICkv337fDGak tSEWJX/ntIMzQfLRrxGjOfOWqaYNbGO01WjArxdlndxMsnDkxUUVer6tBnKa4XsOVVUM 8PBLZPXctLDfO9Z5OMj/EPjfhKThDcZv8EBwheQgMj5jUqnY0PM2P1YacX+74kdIH8P1 hCbA== X-Gm-Message-State: AOAM530867HEIV6kahHEgf0BU2X+00Nk0bExAkRih0USu6LxbAzmgKxo LjWmTDZzlP/IFBR/hHM25r/l8f7fKzvoOOZJaYbcZw== X-Received: by 2002:a67:bb06:: with SMTP id m6mr13785000vsn.54.1596505874070; Mon, 03 Aug 2020 18:51:14 -0700 (PDT) MIME-Version: 1.0 References: <1596445047-2975-1-git-send-email-hsin-hsiung.wang@mediatek.com> <1596445047-2975-2-git-send-email-hsin-hsiung.wang@mediatek.com> In-Reply-To: <1596445047-2975-2-git-send-email-hsin-hsiung.wang@mediatek.com> From: Nicolas Boichat Date: Tue, 4 Aug 2020 09:51:03 +0800 Message-ID: Subject: Re: [PATCH 1/3] spmi: Add driver shutdown support To: Hsin-Hsiung Wang Cc: Mark Brown , Rob Herring , Matthias Brugger , Liam Girdwood , Stephen Boyd , lkml , Devicetree List , linux-arm Mailing List , "moderated list:ARM/Mediatek SoC support" , linux-arm-msm@vger.kernel.org, srv_heupstream Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 3, 2020 at 4:57 PM Hsin-Hsiung Wang wrote: > > 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)); Slight more succinct (assuming sdrv _can_ actually be NULL, I'm not sure about that) if (srdv && sdrv->shutdown) > +} > +} > + > 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) > -- > 2.6.4