* [PATCH v2 10/16] drivers: hv: move device_to_hv_device to use container_of_const() [not found] <20230111113018.459199-1-gregkh@linuxfoundation.org> @ 2023-01-11 11:30 ` Greg Kroah-Hartman 2023-01-12 14:04 ` Wei Liu 0 siblings, 1 reply; 2+ messages in thread From: Greg Kroah-Hartman @ 2023-01-11 11:30 UTC (permalink / raw) To: linux-kernel Cc: Greg Kroah-Hartman, K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, linux-hyperv 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" <kys@microsoft.com> Cc: Haiyang Zhang <haiyangz@microsoft.com> Cc: Wei Liu <wei.liu@kernel.org> Cc: Dexuan Cui <decui@microsoft.com> Cc: linux-hyperv@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- include/linux/hyperv.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 85f7c5a63aa6..8430e27f3c3f 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -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) { -- 2.39.0 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 10/16] drivers: hv: move device_to_hv_device to use container_of_const() 2023-01-11 11:30 ` [PATCH v2 10/16] drivers: hv: move device_to_hv_device to use container_of_const() Greg Kroah-Hartman @ 2023-01-12 14:04 ` Wei Liu 0 siblings, 0 replies; 2+ messages in thread From: Wei Liu @ 2023-01-12 14:04 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: linux-kernel, K. Y. Srinivasan, Haiyang Zhang, Wei Liu, Dexuan Cui, linux-hyperv On Wed, Jan 11, 2023 at 12:30:12PM +0100, Greg Kroah-Hartman wrote: > 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" <kys@microsoft.com> > Cc: Haiyang Zhang <haiyangz@microsoft.com> > Cc: Wei Liu <wei.liu@kernel.org> > Cc: Dexuan Cui <decui@microsoft.com> > Cc: linux-hyperv@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Wei Liu <wei.liu@kernel.org> ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-12 14:10 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20230111113018.459199-1-gregkh@linuxfoundation.org> 2023-01-11 11:30 ` [PATCH v2 10/16] drivers: hv: move device_to_hv_device to use container_of_const() Greg Kroah-Hartman 2023-01-12 14:04 ` Wei Liu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).