Skip to content

Commit 47446b5

Browse files
committed
firmware_loader: fix up to_fw_sysfs() to preserve const
to_fw_sysfs() was changed in commit 23680f0 ("driver core: make struct class.dev_uevent() take a const *") to pass in a const pointer but not pass it back out to handle some changes in the driver core. That isn't the best idea as it could cause problems if used incorrectly, so switch to use the container_of_const() macro instead which will preserve the const status of the pointer and enforce it by the compiler. Fixes: 23680f0 ("driver core: make struct class.dev_uevent() take a const *") Cc: Luis Chamberlain <[email protected]> Reviewed-by: Sakari Ailus <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Acked-by: Russ Weight <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c3da679 commit 47446b5

File tree

1 file changed

+1
-5
lines changed
  • drivers/base/firmware_loader

1 file changed

+1
-5
lines changed

drivers/base/firmware_loader/sysfs.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,7 @@ struct fw_sysfs {
8080
struct firmware *fw;
8181
void *fw_upload_priv;
8282
};
83-
84-
static inline struct fw_sysfs *to_fw_sysfs(const struct device *dev)
85-
{
86-
return container_of(dev, struct fw_sysfs, dev);
87-
}
83+
#define to_fw_sysfs(__dev) container_of_const(__dev, struct fw_sysfs, dev)
8884

8985
void __fw_load_abort(struct fw_priv *fw_priv);
9086

0 commit comments

Comments
 (0)