Chrome platform driver development
 help / color / mirror / Atom feed
* [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register()
@ 2024-03-30 19:49 Krzysztof Kozlowski
  2024-03-30 19:49 ` [PATCH 1/2] " Krzysztof Kozlowski
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-03-30 19:49 UTC (permalink / raw)
  To: Tzung-Bi Shih, Brian Norris, Julius Werner
  Cc: chrome-platform, linux-kernel, Krzysztof Kozlowski

Moving the .owner setting code to the core this effectively fixes
missing .owner in framebuffer-coreboot, memconsole-coreboot and vpd
drivers.

Best regards,
Krzysztof

---
Krzysztof Kozlowski (2):
      firmware: coreboot: store owner from modules with coreboot_driver_register()
      firmware: google: cbmem: drop driver owner initialization

 drivers/firmware/google/cbmem.c          | 1 -
 drivers/firmware/google/coreboot_table.c | 6 ++++--
 drivers/firmware/google/coreboot_table.h | 6 +++++-
 3 files changed, 9 insertions(+), 4 deletions(-)
---
base-commit: 7fdcff3312e16ba8d1419f8a18f465c5cc235ecf
change-id: 20240330-module-owner-coreboot-114292b6d11b

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] firmware: coreboot: store owner from modules with coreboot_driver_register()
  2024-03-30 19:49 [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register() Krzysztof Kozlowski
@ 2024-03-30 19:49 ` Krzysztof Kozlowski
  2024-03-30 19:49 ` [PATCH 2/2] firmware: google: cbmem: drop driver owner initialization Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-03-30 19:49 UTC (permalink / raw)
  To: Tzung-Bi Shih, Brian Norris, Julius Werner
  Cc: chrome-platform, linux-kernel, Krzysztof Kozlowski

Modules registering driver with coreboot_driver_register() might
forget to set .owner field.  The field is used by some of other kernel
parts for reference counting (try_module_get()), so it is expected that
drivers will set it.

Solve the problem by moving this task away from the drivers to the core
code, just like we did for platform_driver in
commit 9447057eaff8 ("platform_device: use a macro instead of
platform_driver_register").

Moving the .owner setting code to the core this effectively fixes
missing .owner in framebuffer-coreboot, memconsole-coreboot and vpd
drivers.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/firmware/google/coreboot_table.c | 6 ++++--
 drivers/firmware/google/coreboot_table.h | 6 +++++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c
index d4b6e581a6c6..fa7752f6e89b 100644
--- a/drivers/firmware/google/coreboot_table.c
+++ b/drivers/firmware/google/coreboot_table.c
@@ -85,13 +85,15 @@ static void coreboot_device_release(struct device *dev)
 	kfree(device);
 }
 
-int coreboot_driver_register(struct coreboot_driver *driver)
+int __coreboot_driver_register(struct coreboot_driver *driver,
+			       struct module *owner)
 {
 	driver->drv.bus = &coreboot_bus_type;
+	driver->drv.owner = owner;
 
 	return driver_register(&driver->drv);
 }
-EXPORT_SYMBOL(coreboot_driver_register);
+EXPORT_SYMBOL(__coreboot_driver_register);
 
 void coreboot_driver_unregister(struct coreboot_driver *driver)
 {
diff --git a/drivers/firmware/google/coreboot_table.h b/drivers/firmware/google/coreboot_table.h
index 86427989c57f..bb6f0f7299b4 100644
--- a/drivers/firmware/google/coreboot_table.h
+++ b/drivers/firmware/google/coreboot_table.h
@@ -97,8 +97,12 @@ struct coreboot_driver {
 	const struct coreboot_device_id *id_table;
 };
 
+/* use a macro to avoid include chaining to get THIS_MODULE */
+#define coreboot_driver_register(driver) \
+	__coreboot_driver_register(driver, THIS_MODULE)
 /* Register a driver that uses the data from a coreboot table. */
-int coreboot_driver_register(struct coreboot_driver *driver);
+int __coreboot_driver_register(struct coreboot_driver *driver,
+			       struct module *owner);
 
 /* Unregister a driver that uses the data from a coreboot table. */
 void coreboot_driver_unregister(struct coreboot_driver *driver);

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] firmware: google: cbmem: drop driver owner initialization
  2024-03-30 19:49 [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register() Krzysztof Kozlowski
  2024-03-30 19:49 ` [PATCH 1/2] " Krzysztof Kozlowski
@ 2024-03-30 19:49 ` Krzysztof Kozlowski
  2024-04-24  6:40 ` [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register() Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-03-30 19:49 UTC (permalink / raw)
  To: Tzung-Bi Shih, Brian Norris, Julius Werner
  Cc: chrome-platform, linux-kernel, Krzysztof Kozlowski

Core in coreboot_driver_register() already sets the .owner, so driver
does not need to.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/firmware/google/cbmem.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/firmware/google/cbmem.c b/drivers/firmware/google/cbmem.c
index c2bffdc352a3..6f810d720f4d 100644
--- a/drivers/firmware/google/cbmem.c
+++ b/drivers/firmware/google/cbmem.c
@@ -124,7 +124,6 @@ static struct coreboot_driver cbmem_entry_driver = {
 	.probe = cbmem_entry_probe,
 	.drv = {
 		.name = "cbmem",
-		.owner = THIS_MODULE,
 		.dev_groups = dev_groups,
 	},
 	.id_table = cbmem_ids,

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register()
  2024-03-30 19:49 [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register() Krzysztof Kozlowski
  2024-03-30 19:49 ` [PATCH 1/2] " Krzysztof Kozlowski
  2024-03-30 19:49 ` [PATCH 2/2] firmware: google: cbmem: drop driver owner initialization Krzysztof Kozlowski
@ 2024-04-24  6:40 ` Krzysztof Kozlowski
  2024-04-24  8:43   ` Tzung-Bi Shih
  2024-05-27  2:55 ` patchwork-bot+chrome-platform
  2024-05-27  3:07 ` patchwork-bot+chrome-platform
  4 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-24  6:40 UTC (permalink / raw)
  To: Tzung-Bi Shih, Brian Norris, Julius Werner; +Cc: chrome-platform, linux-kernel

On 30/03/2024 20:49, Krzysztof Kozlowski wrote:
> Moving the .owner setting code to the core this effectively fixes
> missing .owner in framebuffer-coreboot, memconsole-coreboot and vpd
> drivers.
> 

It has been almost a month. Any comments on this patchset?

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register()
  2024-04-24  6:40 ` [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register() Krzysztof Kozlowski
@ 2024-04-24  8:43   ` Tzung-Bi Shih
  0 siblings, 0 replies; 7+ messages in thread
From: Tzung-Bi Shih @ 2024-04-24  8:43 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Brian Norris, Julius Werner, chrome-platform, linux-kernel

On Wed, Apr 24, 2024 at 08:40:34AM +0200, Krzysztof Kozlowski wrote:
> On 30/03/2024 20:49, Krzysztof Kozlowski wrote:
> > Moving the .owner setting code to the core this effectively fixes
> > missing .owner in framebuffer-coreboot, memconsole-coreboot and vpd
> > drivers.
> > 
> 
> It has been almost a month. Any comments on this patchset?

They have been applied for a while, thanks!  Just realized this email was
forgotten.

[1/2] firmware: coreboot: store owner from modules with coreboot_driver_register()
      commit: 46c6685e7e886b7fa098465f8bfd139a253365e4
[2/2] firmware: google: cbmem: drop driver owner initialization
      commit: 7f20f21c22aa22e488530f66bf4fc168e427f5bd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register()
  2024-03-30 19:49 [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register() Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2024-04-24  6:40 ` [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register() Krzysztof Kozlowski
@ 2024-05-27  2:55 ` patchwork-bot+chrome-platform
  2024-05-27  3:07 ` patchwork-bot+chrome-platform
  4 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+chrome-platform @ 2024-05-27  2:55 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: tzungbi, briannorris, jwerner, chrome-platform, linux-kernel

Hello:

This series was applied to chrome-platform/linux.git (for-kernelci)
by Tzung-Bi Shih <tzungbi@kernel.org>:

On Sat, 30 Mar 2024 20:49:46 +0100 you wrote:
> Moving the .owner setting code to the core this effectively fixes
> missing .owner in framebuffer-coreboot, memconsole-coreboot and vpd
> drivers.
> 
> Best regards,
> Krzysztof
> 
> [...]

Here is the summary with links:
  - [1/2] firmware: coreboot: store owner from modules with coreboot_driver_register()
    https://git.kernel.org/chrome-platform/c/46c6685e7e88
  - [2/2] firmware: google: cbmem: drop driver owner initialization
    https://git.kernel.org/chrome-platform/c/7f20f21c22aa

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register()
  2024-03-30 19:49 [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register() Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2024-05-27  2:55 ` patchwork-bot+chrome-platform
@ 2024-05-27  3:07 ` patchwork-bot+chrome-platform
  4 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+chrome-platform @ 2024-05-27  3:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: tzungbi, briannorris, jwerner, chrome-platform, linux-kernel

Hello:

This series was applied to chrome-platform/linux.git (for-next)
by Tzung-Bi Shih <tzungbi@kernel.org>:

On Sat, 30 Mar 2024 20:49:46 +0100 you wrote:
> Moving the .owner setting code to the core this effectively fixes
> missing .owner in framebuffer-coreboot, memconsole-coreboot and vpd
> drivers.
> 
> Best regards,
> Krzysztof
> 
> [...]

Here is the summary with links:
  - [1/2] firmware: coreboot: store owner from modules with coreboot_driver_register()
    https://git.kernel.org/chrome-platform/c/46c6685e7e88
  - [2/2] firmware: google: cbmem: drop driver owner initialization
    https://git.kernel.org/chrome-platform/c/7f20f21c22aa

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-05-27  3:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-30 19:49 [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register() Krzysztof Kozlowski
2024-03-30 19:49 ` [PATCH 1/2] " Krzysztof Kozlowski
2024-03-30 19:49 ` [PATCH 2/2] firmware: google: cbmem: drop driver owner initialization Krzysztof Kozlowski
2024-04-24  6:40 ` [PATCH 0/2] firmware: coreboot: store owner from modules with coreboot_driver_register() Krzysztof Kozlowski
2024-04-24  8:43   ` Tzung-Bi Shih
2024-05-27  2:55 ` patchwork-bot+chrome-platform
2024-05-27  3:07 ` patchwork-bot+chrome-platform

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox