public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Brian Norris <briannorris@chromium.org>
Cc: Benson Leung <bleung@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	chrome-platform@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] platform/chrome: cros_ec_lpc: Move mec_init/destroy to device probe/remove
Date: Mon, 31 Oct 2022 12:55:57 +0800	[thread overview]
Message-ID: <Y19VXaB1531V64EI@google.com> (raw)
In-Reply-To: <20221028141411.1.I0728421299079b104710c202d5d7095b2674fd8c@changeid>

On Fri, Oct 28, 2022 at 02:14:45PM -0700, Brian Norris wrote:
> Disregarding the weird global state hiding in this cros_ec_lpc_mec_*()
> stuff, it belongs in device probe/remove. We shouldn't assume we can
> access hardware resources when the device isn't attached to the driver.

It's also weird that cros_ec_lpc_mec_destroy() destroies a statically
allocated mutex[1].  How about let's remove it?

[1]: https://elixir.bootlin.com/linux/v6.0/source/drivers/platform/chrome/cros_ec_lpc_mec.c#L152

> @@ -586,9 +591,6 @@ static int __init cros_ec_lpc_init(void)
>  		return -ENODEV;
>  	}
>  
> -	cros_ec_lpc_mec_init(EC_HOST_CMD_REGION0,
> -			     EC_LPC_ADDR_MEMMAP + EC_MEMMAP_SIZE);
> -
>  	/* Register the driver */
>  	ret = platform_driver_register(&cros_ec_lpc_driver);
>  	if (ret) {

There are 2 more cros_ec_lpc_mec_destroy()s need to be removed [2][3] though.

[2]: https://elixir.bootlin.com/linux/v6.0/source/drivers/platform/chrome/cros_ec_lpc.c#L596
[3]: https://elixir.bootlin.com/linux/v6.0/source/drivers/platform/chrome/cros_ec_lpc.c#L606

  parent reply	other threads:[~2022-10-31  4:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 21:14 [PATCH 1/5] platform/chrome: cros_ec_lpc: Move mec_init/destroy to device probe/remove Brian Norris
2022-10-28 21:14 ` [PATCH 2/5] platform/chrome: cros_ec_lpc: Mark PROBE_PREFER_ASYNCHRONOUS Brian Norris
2022-10-28 21:14 ` [PATCH 3/5] platform/chrome: cros_ec_debugfs: Set PROBE_PREFER_ASYNCHRONOUS Brian Norris
2022-10-28 21:14 ` [PATCH 4/5] platform/chrome: cros_ec_lightbar: " Brian Norris
2022-10-28 21:14 ` [PATCH 5/5] platform/chrome: cros_ec_spi: " Brian Norris
2022-10-31  4:55 ` Tzung-Bi Shih [this message]
2022-10-31  5:14   ` [PATCH 1/5] platform/chrome: cros_ec_lpc: Move mec_init/destroy to device probe/remove Tzung-Bi Shih
2022-10-31 16:42   ` Brian Norris
2022-11-02  4:30 ` patchwork-bot+chrome-platform
2022-11-02 12:30 ` patchwork-bot+chrome-platform

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=Y19VXaB1531V64EI@google.com \
    --to=tzungbi@kernel.org \
    --cc=bleung@chromium.org \
    --cc=briannorris@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=groeck@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox