Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1254562 > unrolled thread
| Started by | Eric Auger <eric.auger@linaro.org> |
|---|---|
| First post | 2015-10-23 14:40 +0200 |
| Last post | 2015-10-23 16:20 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v3 3/7] vfio: platform: introduce module_vfio_reset_handler macro Eric Auger <eric.auger@linaro.org> - 2015-10-23 14:40 +0200
Re: [PATCH v3 3/7] vfio: platform: introduce module_vfio_reset_handler macro Arnd Bergmann <arnd@arndb.de> - 2015-10-23 15:10 +0200
Re: [PATCH v3 3/7] vfio: platform: introduce module_vfio_reset_handler macro Eric Auger <eric.auger@linaro.org> - 2015-10-23 16:20 +0200
| From | Eric Auger <eric.auger@linaro.org> |
|---|---|
| Date | 2015-10-23 14:40 +0200 |
| Subject | [PATCH v3 3/7] vfio: platform: introduce module_vfio_reset_handler macro |
| Message-ID | <qmJNy-1va-55@gated-at.bofh.it> |
The module_vfio_reset_handler macro
- define a module alias
- implement module init/exit function which respectively registers
and unregisters the reset function.
Signed-off-by: Eric Auger <eric.auger@linaro.org>
---
v2 -> v3:
- use vfio_platform_register_reset macro
v1 -> v2:
- remove vfio_platform_reset_private.h and move back the macro to
vfio_platform_private.h header: removed reset_module_register &
unregister (symbol_get)
- defines the module_vfio_reset_handler macro as suggested by Arnd
(formerly in vfio_platform_reset_private.h)
---
drivers/vfio/platform/vfio_platform_private.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/vfio/platform/vfio_platform_private.h b/drivers/vfio/platform/vfio_platform_private.h
index 277521a..5a1e8e6 100644
--- a/drivers/vfio/platform/vfio_platform_private.h
+++ b/drivers/vfio/platform/vfio_platform_private.h
@@ -110,4 +110,18 @@ static struct vfio_platform_reset_node __reset ## _node = { \
}; \
__vfio_platform_register_reset(&__reset ## _node)
+#define module_vfio_reset_handler(compat, reset) \
+MODULE_ALIAS("vfio-reset:" compat); \
+static int __init reset ## _module_init(void) \
+{ \
+ vfio_platform_register_reset(compat, reset); \
+ return 0; \
+}; \
+static void __exit reset ## _module_exit(void) \
+{ \
+ vfio_platform_unregister_reset(compat); \
+}; \
+module_init(reset ## _module_init); \
+module_exit(reset ## _module_exit)
+
#endif /* VFIO_PLATFORM_PRIVATE_H */
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2015-10-23 15:10 +0200 |
| Message-ID | <qmKgy-2iZ-17@gated-at.bofh.it> |
| In reply to | #1254562 |
On Friday 23 October 2015 14:37:11 Eric Auger wrote:
> +static int __init reset ## _module_init(void) \
> +{ \
> + vfio_platform_register_reset(compat, reset); \
> + return 0; \
> +}; \
>
I would make this 'return vfio_platform_register_reset(...)', so loading
the driver fails if the handler cannot get registered. Alternatively,
change the return type of vfio_platform_register_reset to 'void'
so it can never fail.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Eric Auger <eric.auger@linaro.org> |
|---|---|
| Date | 2015-10-23 16:20 +0200 |
| Subject | Re: [PATCH v3 3/7] vfio: platform: introduce module_vfio_reset_handler macro |
| Message-ID | <qmLmi-3Q4-3@gated-at.bofh.it> |
| In reply to | #1254582 |
Hi Arnd,
On 10/23/2015 03:09 PM, Arnd Bergmann wrote:
> On Friday 23 October 2015 14:37:11 Eric Auger wrote:
>> +static int __init reset ## _module_init(void) \
>> +{ \
>> + vfio_platform_register_reset(compat, reset); \
>> + return 0; \
>> +}; \
>>
>
> I would make this 'return vfio_platform_register_reset(...)', so loading
> the driver fails if the handler cannot get registered. Alternatively,
> change the return type of vfio_platform_register_reset to 'void'
> so it can never fail.
I will turn __vfio_platform_register_reset to 'void' then since it has
no reason to fail now.
Thanks
Eric
>
> Arnd
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web