lkml.org 
[lkml]   [2022]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/5] platform/chrome: cros_ec_lpc: Move mec_init/destroy to device probe/remove
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

\
 
 \ /
  Last update: 2022-10-31 05:56    [W:0.092 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site