All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Bard Liao <yung-chuan.liao@linux.intel.com>
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org, srinivas.kandagatla@linaro.org,
	pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com,
	bard.liao@intel.com
Subject: Re: [PATCH] soundwire: bus_type: fix remove and shutdown support
Date: Thu, 23 Jun 2022 13:25:23 +0530	[thread overview]
Message-ID: <YrQca7YH8v6XCl02@matsya> (raw)
In-Reply-To: <20220610015105.25987-1-yung-chuan.liao@linux.intel.com>

On 10-06-22, 09:51, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> The bus sdw_drv_remove() and sdw_drv_shutdown() helpers are used
> conditionally, if the driver provides these routines.
> 
> These helpers already test if the driver provides a .remove or
> .shutdown callback, so there's no harm in invoking the
> sdw_drv_remove() and sdw_drv_shutdown() unconditionally.

Okay sounds good

> In addition, the current code is imbalanced with
> dev_pm_domain_attach() called from sdw_drv_probe(), but
> dev_pm_domain_detach() called from sdw_drv_remove() only if the driver
> provides a .remove callback.

Am not sure I follow what is imbalance, pm_domain_attach/detach?

> Fixes: 9251345dca24b ("soundwire: Add SoundWire bus type")

How is this a fix is still unclear to me. At best I think this is code
optimization and removing checks which maybe redundant.

> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Reviewed-by: Rander Wang <rander.wang@intel.com>
> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> ---
>  drivers/soundwire/bus_type.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c
> index 893296f3fe39..b81e04dd3a9f 100644
> --- a/drivers/soundwire/bus_type.c
> +++ b/drivers/soundwire/bus_type.c
> @@ -193,12 +193,8 @@ int __sdw_register_driver(struct sdw_driver *drv, struct module *owner)
>  
>  	drv->driver.owner = owner;
>  	drv->driver.probe = sdw_drv_probe;
> -
> -	if (drv->remove)
> -		drv->driver.remove = sdw_drv_remove;
> -
> -	if (drv->shutdown)
> -		drv->driver.shutdown = sdw_drv_shutdown;
> +	drv->driver.remove = sdw_drv_remove;
> +	drv->driver.shutdown = sdw_drv_shutdown;
>  
>  	return driver_register(&drv->driver);
>  }
> -- 
> 2.17.1

-- 
~Vinod

WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vkoul@kernel.org>
To: Bard Liao <yung-chuan.liao@linux.intel.com>
Cc: alsa-devel@alsa-project.org, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org,
	pierre-louis.bossart@linux.intel.com,
	srinivas.kandagatla@linaro.org, sanyog.r.kale@intel.com,
	bard.liao@intel.com
Subject: Re: [PATCH] soundwire: bus_type: fix remove and shutdown support
Date: Thu, 23 Jun 2022 13:25:23 +0530	[thread overview]
Message-ID: <YrQca7YH8v6XCl02@matsya> (raw)
In-Reply-To: <20220610015105.25987-1-yung-chuan.liao@linux.intel.com>

On 10-06-22, 09:51, Bard Liao wrote:
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> 
> The bus sdw_drv_remove() and sdw_drv_shutdown() helpers are used
> conditionally, if the driver provides these routines.
> 
> These helpers already test if the driver provides a .remove or
> .shutdown callback, so there's no harm in invoking the
> sdw_drv_remove() and sdw_drv_shutdown() unconditionally.

Okay sounds good

> In addition, the current code is imbalanced with
> dev_pm_domain_attach() called from sdw_drv_probe(), but
> dev_pm_domain_detach() called from sdw_drv_remove() only if the driver
> provides a .remove callback.

Am not sure I follow what is imbalance, pm_domain_attach/detach?

> Fixes: 9251345dca24b ("soundwire: Add SoundWire bus type")

How is this a fix is still unclear to me. At best I think this is code
optimization and removing checks which maybe redundant.

> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Reviewed-by: Rander Wang <rander.wang@intel.com>
> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> ---
>  drivers/soundwire/bus_type.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c
> index 893296f3fe39..b81e04dd3a9f 100644
> --- a/drivers/soundwire/bus_type.c
> +++ b/drivers/soundwire/bus_type.c
> @@ -193,12 +193,8 @@ int __sdw_register_driver(struct sdw_driver *drv, struct module *owner)
>  
>  	drv->driver.owner = owner;
>  	drv->driver.probe = sdw_drv_probe;
> -
> -	if (drv->remove)
> -		drv->driver.remove = sdw_drv_remove;
> -
> -	if (drv->shutdown)
> -		drv->driver.shutdown = sdw_drv_shutdown;
> +	drv->driver.remove = sdw_drv_remove;
> +	drv->driver.shutdown = sdw_drv_shutdown;
>  
>  	return driver_register(&drv->driver);
>  }
> -- 
> 2.17.1

-- 
~Vinod

  reply	other threads:[~2022-06-23  7:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10  1:51 [PATCH] soundwire: bus_type: fix remove and shutdown support Bard Liao
2022-06-10  1:51 ` Bard Liao
2022-06-23  7:55 ` Vinod Koul [this message]
2022-06-23  7:55   ` Vinod Koul
2022-06-23 14:54   ` Pierre-Louis Bossart
2022-06-23 14:54     ` Pierre-Louis Bossart
2022-07-04  5:43     ` Vinod Koul
2022-07-04  5:43       ` Vinod Koul
2022-07-04  6:20       ` Vinod Koul
2022-07-04  6:20         ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YrQca7YH8v6XCl02@matsya \
    --to=vkoul@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=bard.liao@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=sanyog.r.kale@intel.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.