Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2 prettify and add to all the modules th...
details: https://anonhg.NetBSD.org/src/rev/46bfc565c73b
branches: trunk
changeset: 333642:46bfc565c73b
user: christos <christos%NetBSD.org@localhost>
date: Wed Nov 12 03:14:00 2014 +0000
description:
prettify and add to all the modules that have it.
diffstat:
sys/external/bsd/drm2/drm/drm_module.c | 10 +++++++---
sys/external/bsd/drm2/drm/drm_sysctl.c | 24 +++++++++++++-----------
sys/external/bsd/drm2/i915drm/i915_module.c | 18 +++++-------------
sys/external/bsd/drm2/include/drm/drm_sysctl.h | 21 +++++++++++++++++++--
sys/external/bsd/drm2/nouveau/nouveau_module.c | 9 +++++++--
sys/external/bsd/drm2/radeon/radeon_module.c | 10 +++++++---
6 files changed, 58 insertions(+), 34 deletions(-)
diffs (truncated from 311 to 300 lines):
diff -r 90eeda8b9bb7 -r 46bfc565c73b sys/external/bsd/drm2/drm/drm_module.c
--- a/sys/external/bsd/drm2/drm/drm_module.c Wed Nov 12 03:12:35 2014 +0000
+++ b/sys/external/bsd/drm2/drm/drm_module.c Wed Nov 12 03:14:00 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_module.c,v 1.8 2014/09/14 20:08:21 riastradh Exp $ */
+/* $NetBSD: drm_module.c,v 1.9 2014/11/12 03:14:00 christos Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.8 2014/09/14 20:08:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_module.c,v 1.9 2014/11/12 03:14:00 christos Exp $");
#include <sys/types.h>
#include <sys/conf.h>
@@ -45,6 +45,7 @@
#include <linux/mutex.h>
#include <drm/drmP.h>
+#include <drm/drm_sysctl.h>
/*
* XXX I2C stuff should be moved to a separate drmkms_i2c module.
@@ -53,6 +54,8 @@
struct mutex drm_global_mutex;
+struct drm_sysctl_def drm_def = DRM_SYSCTL_INIT();
+
static int
drm_init(void)
{
@@ -71,6 +74,7 @@
linux_mutex_init(&drm_global_mutex);
drm_connector_ida_init();
drm_global_init();
+ drm_sysctl_init(&drm_def);
return 0;
}
@@ -91,7 +95,7 @@
static void
drm_fini(void)
{
-
+ drm_sysctl_fini(&drm_def);
drm_global_release();
drm_connector_ida_destroy();
linux_mutex_destroy(&drm_global_mutex);
diff -r 90eeda8b9bb7 -r 46bfc565c73b sys/external/bsd/drm2/drm/drm_sysctl.c
--- a/sys/external/bsd/drm2/drm/drm_sysctl.c Wed Nov 12 03:12:35 2014 +0000
+++ b/sys/external/bsd/drm2/drm/drm_sysctl.c Wed Nov 12 03:14:00 2014 +0000
@@ -27,7 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: drm_sysctl.c,v 1.1 2014/11/12 02:24:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_sysctl.c,v 1.2 2014/11/12 03:14:00 christos Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -41,9 +41,10 @@
#include <drm/drm_sysctl.h>
static const char *
-drm_sysctl_get_description(const struct linux_module_param_info *p, const void **v)
+drm_sysctl_get_description(const struct linux_module_param_info *p,
+ const struct drm_sysctl_def *def)
{
- const void * const *b = v[0], * const *e = v[1];
+ const void * const *b = def->bd, * const *e = def->ed;
for (; b < e; b++) {
const struct linux_module_param_desc *d = *b;
@@ -112,14 +113,14 @@
void
-drm_sysctl_init(const void **v, struct sysctllog **log)
+drm_sysctl_init(struct drm_sysctl_def *def)
{
- const void * const *b = v[0], * const *e = v[1];
+ const void * const *b = def->bp, * const *e = def->ep;
const struct sysctlnode *rnode = NULL, *cnode;
const char *name = "drm2";
int error;
- if ((error = sysctl_createv(log, 0, NULL, &rnode,
+ if ((error = sysctl_createv(&def->log, 0, NULL, &rnode,
CTLFLAG_PERMANENT, CTLTYPE_NODE, name,
SYSCTL_DESCR("DRM driver parameters"),
NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL)) != 0) {
@@ -135,17 +136,18 @@
cnode = rnode;
for (n = copy; (nn = strchr(n, '.')) != NULL; n = nn) {
*nn++ = '\0';
- if ((error = drm_sysctl_node(n, &cnode, log)) != 0) {
+ if ((error = drm_sysctl_node(n, &cnode, &def->log))
+ != 0) {
aprint_error("sysctl_createv returned %d, "
"for %s ignoring\n", error, n);
continue;
}
}
- if ((error = sysctl_createv(log, 0, &cnode,
+ if ((error = sysctl_createv(&def->log, 0, &cnode,
&cnode, p->mode == 0600 ? CTLFLAG_READWRITE : 0,
drm_sysctl_get_type(p), n,
- SYSCTL_DESCR(drm_sysctl_get_description(p, v + 2)),
+ SYSCTL_DESCR(drm_sysctl_get_description(p, def)),
NULL, 0, p->ptr, 0, CTL_CREATE, CTL_EOL)) != 0)
aprint_error("sysctl_createv returned %d, "
"for %s ignoring\n", error, n);
@@ -153,7 +155,7 @@
}
void
-drm_sysctl_fini(struct sysctllog **log)
+drm_sysctl_fini(struct drm_sysctl_def *def)
{
- sysctl_teardown(log);
+ sysctl_teardown(&def->log);
}
diff -r 90eeda8b9bb7 -r 46bfc565c73b sys/external/bsd/drm2/i915drm/i915_module.c
--- a/sys/external/bsd/drm2/i915drm/i915_module.c Wed Nov 12 03:12:35 2014 +0000
+++ b/sys/external/bsd/drm2/i915drm/i915_module.c Wed Nov 12 03:14:00 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i915_module.c,v 1.4 2014/11/12 02:24:40 christos Exp $ */
+/* $NetBSD: i915_module.c,v 1.5 2014/11/12 03:14:00 christos Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_module.c,v 1.4 2014/11/12 02:24:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_module.c,v 1.5 2014/11/12 03:14:00 christos Exp $");
#include <sys/types.h>
#include <sys/module.h>
@@ -55,9 +55,7 @@
extern const struct pci_device_id *const i915_device_ids;
extern const size_t i915_n_device_ids;
-static struct sysctllog *i915_sysctllog;
-__link_set_decl(linux_module_param_info, struct linux_module_param_info);
-__link_set_decl(linux_module_param_desc, struct linux_module_param_desc);
+struct drm_sysctl_def i915_def = DRM_SYSCTL_INIT();
static int
i915drmkms_init(void)
@@ -79,13 +77,7 @@
error);
return error;
}
- const void *v[] = {
- __link_set_start(linux_module_param_info),
- __link_set_end(linux_module_param_info),
- __link_set_start(linux_module_param_desc),
- __link_set_end(linux_module_param_desc),
- };
- drm_sysctl_init(v, &i915_sysctllog);
+ drm_sysctl_init(&i915_def);
return 0;
}
@@ -108,7 +100,7 @@
{
drm_pci_exit(i915_drm_driver, NULL);
- drm_sysctl_fini(&i915_sysctllog);
+ drm_sysctl_fini(&i915_def);
}
static int
diff -r 90eeda8b9bb7 -r 46bfc565c73b sys/external/bsd/drm2/include/drm/drm_sysctl.h
--- a/sys/external/bsd/drm2/include/drm/drm_sysctl.h Wed Nov 12 03:12:35 2014 +0000
+++ b/sys/external/bsd/drm2/include/drm/drm_sysctl.h Wed Nov 12 03:14:00 2014 +0000
@@ -27,5 +27,22 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
struct sysctllog;
-extern void drm_sysctl_init(const void **, struct sysctllog **);
-extern void drm_sysctl_fini(struct sysctllog **);
+
+struct drm_sysctl_def {
+ struct sysctllog *log;
+ const void *bp, *ep, *bd, *ed;
+};
+
+void drm_sysctl_init(struct drm_sysctl_def *);
+void drm_sysctl_fini(struct drm_sysctl_def *);
+
+#define DRM_SYSCTL_INIT() { \
+ NULL, \
+ __link_set_start(linux_module_param_info), \
+ __link_set_end(linux_module_param_info), \
+ __link_set_start(linux_module_param_desc), \
+ __link_set_end(linux_module_param_desc), \
+};
+
+__link_set_decl(linux_module_param_info, struct linux_module_param_info);
+__link_set_decl(linux_module_param_desc, struct linux_module_param_desc);
diff -r 90eeda8b9bb7 -r 46bfc565c73b sys/external/bsd/drm2/nouveau/nouveau_module.c
--- a/sys/external/bsd/drm2/nouveau/nouveau_module.c Wed Nov 12 03:12:35 2014 +0000
+++ b/sys/external/bsd/drm2/nouveau/nouveau_module.c Wed Nov 12 03:14:00 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nouveau_module.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $ */
+/* $NetBSD: nouveau_module.c,v 1.3 2014/11/12 03:14:00 christos Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nouveau_module.c,v 1.2 2014/08/23 08:03:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_module.c,v 1.3 2014/11/12 03:14:00 christos Exp $");
#include <sys/types.h>
#include <sys/module.h>
@@ -40,6 +40,7 @@
#include <sys/systm.h>
#include <drm/drmP.h>
+#include <drm/drm_sysctl.h>
#include <core/object.h>
#include <engine/device.h>
@@ -50,6 +51,8 @@
#include "ioconf.c"
#endif
+struct drm_sysctl_def nouveau_def = DRM_SYSCTL_INIT();
+
extern struct drm_driver *const nouveau_drm_driver; /* XXX */
static int
@@ -73,6 +76,7 @@
#if 0 /* XXX nouveau acpi */
nouveau_register_dsm_handler();
#endif
+ drm_sysctl_init(&nouveau_def);
return 0;
}
@@ -94,6 +98,7 @@
nouveau_fini(void)
{
+ drm_sysctl_fini(&nouveau_def);
#if 0 /* XXX nouveau acpi */
nouveau_unregister_dsm_handler();
#endif
diff -r 90eeda8b9bb7 -r 46bfc565c73b sys/external/bsd/drm2/radeon/radeon_module.c
--- a/sys/external/bsd/drm2/radeon/radeon_module.c Wed Nov 12 03:12:35 2014 +0000
+++ b/sys/external/bsd/drm2/radeon/radeon_module.c Wed Nov 12 03:14:00 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: radeon_module.c,v 1.2 2014/07/26 21:12:43 riastradh Exp $ */
+/* $NetBSD: radeon_module.c,v 1.3 2014/11/12 03:14:00 christos Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radeon_module.c,v 1.2 2014/07/26 21:12:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeon_module.c,v 1.3 2014/11/12 03:14:00 christos Exp $");
#include <sys/types.h>
#include <sys/module.h>
@@ -40,6 +40,7 @@
#include <sys/systm.h>
#include <drm/drmP.h>
+#include <drm/drm_sysctl.h>
#include "radeon_drv.h"
@@ -53,6 +54,8 @@
extern struct drm_driver *const radeon_drm_driver;
extern int radeon_max_kms_ioctl;
+struct drm_sysctl_def radeon_def = DRM_SYSCTL_INIT();
+
static int
radeon_init(void)
{
@@ -72,6 +75,7 @@
error);
return error;
}
+ drm_sysctl_init(&radeon_def);
Home |
Main Index |
Thread Index |
Old Index