Skip to content

Commit

Permalink
drivers: hv: move device_to_hv_device to use container_of_const()
Browse files Browse the repository at this point in the history
The driver core is changing to pass some pointers as const, so move
device_to_hv_device() to use container_of_const() to handle this change.

device_to_hv_device() now properly keeps the const-ness of the pointer
passed into it, while as before it could be lost.

Cc: "K. Y. Srinivasan" <[email protected]>
Cc: Haiyang Zhang <[email protected]>
Cc: Dexuan Cui <[email protected]>
Acked-by: Wei Liu <[email protected]>
Acked-by: Hans de Goede <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
gregkh committed Jan 27, 2023
1 parent 2f89e23 commit 8afdae8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions include/linux/hyperv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1309,10 +1309,7 @@ struct hv_device {
};


static inline struct hv_device *device_to_hv_device(struct device *d)
{
return container_of(d, struct hv_device, device);
}
#define device_to_hv_device(d) container_of_const(d, struct hv_device, device)

static inline struct hv_driver *drv_to_hv_drv(struct device_driver *d)
{
Expand Down

0 comments on commit 8afdae8

Please sign in to comment.