Module Name:    src
Committed By:   riastradh
Date:           Sun Sep  8 16:11:29 UTC 2013

Modified Files:
        src/sys/external/bsd/drm2/dist/drm [riastradh-drm2]: drm_context.c
            drm_crtc.c drm_edid.c drm_gem.c drm_global.c drm_irq.c
        src/sys/external/bsd/drm2/dist/include/drm [riastradh-drm2]: drmP.h
            drm_crtc.h drm_mm.h
        src/sys/modules/drm2 [riastradh-drm2]: Makefile

Log Message:
Remove some more needless #ifdef __NetBSD__.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.2.6 -r1.1.1.1.2.7 \
    src/sys/external/bsd/drm2/dist/drm/drm_context.c
cvs rdiff -u -r1.1.1.1.2.17 -r1.1.1.1.2.18 \
    src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
cvs rdiff -u -r1.1.1.1.2.10 -r1.1.1.1.2.11 \
    src/sys/external/bsd/drm2/dist/drm/drm_edid.c
cvs rdiff -u -r1.1.1.1.2.7 -r1.1.1.1.2.8 \
    src/sys/external/bsd/drm2/dist/drm/drm_gem.c
cvs rdiff -u -r1.1.1.1.2.5 -r1.1.1.1.2.6 \
    src/sys/external/bsd/drm2/dist/drm/drm_global.c
cvs rdiff -u -r1.1.1.1.2.9 -r1.1.1.1.2.10 \
    src/sys/external/bsd/drm2/dist/drm/drm_irq.c
cvs rdiff -u -r1.1.1.1.2.51 -r1.1.1.1.2.52 \
    src/sys/external/bsd/drm2/dist/include/drm/drmP.h
cvs rdiff -u -r1.1.1.1.2.5 -r1.1.1.1.2.6 \
    src/sys/external/bsd/drm2/dist/include/drm/drm_crtc.h
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
    src/sys/external/bsd/drm2/dist/include/drm/drm_mm.h
cvs rdiff -u -r1.1.2.40 -r1.1.2.41 src/sys/modules/drm2/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/drm_context.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_context.c:1.1.1.1.2.6 src/sys/external/bsd/drm2/dist/drm/drm_context.c:1.1.1.1.2.7
--- src/sys/external/bsd/drm2/dist/drm/drm_context.c:1.1.1.1.2.6	Wed Jul 24 03:55:48 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_context.c	Sun Sep  8 16:11:29 2013
@@ -121,9 +121,7 @@ void drm_ctxbitmap_cleanup(struct drm_de
 {
 	mutex_lock(&dev->struct_mutex);
 	idr_remove_all(&dev->ctx_idr);
-#ifdef __NetBSD__
 	idr_destroy(&dev->ctx_idr);
-#endif
 	mutex_unlock(&dev->struct_mutex);
 }
 
@@ -267,10 +265,7 @@ static int drm_context_switch_complete(s
 				       struct drm_file *file_priv, int new)
 {
 	dev->last_context = new;	/* PRE/POST: This is the _only_ writer. */
-#ifndef __NetBSD__
-	/* XXX Nobody seems to use last_switch. */
 	dev->last_switch = jiffies;
-#endif
 
 	if (!_DRM_LOCK_IS_HELD(file_priv->master->lock.hw_lock->lock)) {
 		DRM_ERROR("Lock isn't held after context switch\n");

Index: src/sys/external/bsd/drm2/dist/drm/drm_crtc.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.17 src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.18
--- src/sys/external/bsd/drm2/dist/drm/drm_crtc.c:1.1.1.1.2.17	Sun Sep  8 15:57:54 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_crtc.c	Sun Sep  8 16:11:29 2013
@@ -41,8 +41,6 @@
 #include <drm/drm_fourcc.h>
 
 /* Avoid boilerplate.  I'm tired of typing. */
-#ifdef __NetBSD__
-/* XXX Does nobody build this code with -Wwrite-strings?  */
 #define DRM_ENUM_NAME_FN(fnname, list)				\
 	const char *fnname(int val)				\
 	{							\
@@ -53,18 +51,6 @@
 		}						\
 		return "(unknown)";				\
 	}
-#else
-#define DRM_ENUM_NAME_FN(fnname, list)				\
-	char *fnname(int val)					\
-	{							\
-		int i;						\
-		for (i = 0; i < ARRAY_SIZE(list); i++) {	\
-			if (list[i].type == val)		\
-				return list[i].name;		\
-		}						\
-		return "(unknown)";				\
-	}
-#endif
 
 /*
  * Global properties
@@ -155,11 +141,7 @@ DRM_ENUM_NAME_FN(drm_get_dirty_info_name
 
 struct drm_conn_prop_enum_list {
 	int type;
-#ifdef __NetBSD__
 	const char *name;
-#else
-	char *name;
-#endif
 	int count;
 };
 
@@ -858,13 +840,8 @@ EXPORT_SYMBOL(drm_mode_create_dvi_i_prop
  * responsible for allocating a list of format names and passing them to
  * this routine.
  */
-#ifdef __NetBSD__		/* XXX const */
 int drm_mode_create_tv_properties(struct drm_device *dev, int num_modes,
 				  const char *modes[])
-#else
-int drm_mode_create_tv_properties(struct drm_device *dev, int num_modes,
-				  char *modes[])
-#endif
 {
 	struct drm_property *tv_selector;
 	struct drm_property *tv_subconnector;
@@ -1047,10 +1024,8 @@ void drm_mode_config_init(struct drm_dev
 }
 EXPORT_SYMBOL(drm_mode_config_init);
 
-#ifdef __NetBSD__
-static
-#endif
-int drm_mode_group_init(struct drm_device *dev, struct drm_mode_group *group)
+static int drm_mode_group_init(struct drm_device *dev,
+			       struct drm_mode_group *group)
 {
 	uint32_t total_objects = 0;
 
@@ -2667,12 +2642,7 @@ int drm_mode_attachmode_crtc(struct drm_
 		if (!connector->encoder)
 			continue;
 		if (connector->encoder->crtc == crtc)
-#ifdef __NetBSD__
-			list_move_tail(list_next(&list),
-			    &connector->user_modes);
-#else
 			list_move_tail(list.next, &connector->user_modes);
-#endif
 	}
 
 	WARN_ON(!list_empty(&list));
@@ -3531,21 +3501,13 @@ int drm_mode_gamma_set_ioctl(struct drm_
 		goto out;
 	}
 
-#ifdef __NetBSD__
 	g_base = (char *)r_base + size;
-#else
-	g_base = r_base + size;
-#endif
 	if (copy_from_user(g_base, (void __user *)(unsigned long)crtc_lut->green, size)) {
 		ret = -EFAULT;
 		goto out;
 	}
 
-#ifdef __NetBSD__
 	b_base = (char *)g_base + size;
-#else
-	b_base = g_base + size;
-#endif
 	if (copy_from_user(b_base, (void __user *)(unsigned long)crtc_lut->blue, size)) {
 		ret = -EFAULT;
 		goto out;
@@ -3593,21 +3555,13 @@ int drm_mode_gamma_get_ioctl(struct drm_
 		goto out;
 	}
 
-#ifdef __NetBSD__
 	g_base = (char *)r_base + size;
-#else
-	g_base = r_base + size;
-#endif
 	if (copy_to_user((void __user *)(unsigned long)crtc_lut->green, g_base, size)) {
 		ret = -EFAULT;
 		goto out;
 	}
 
-#ifdef __NetBSD__
 	b_base = (char *)g_base + size;
-#else
-	b_base = g_base + size;
-#endif
 	if (copy_to_user((void __user *)(unsigned long)crtc_lut->blue, b_base, size)) {
 		ret = -EFAULT;
 		goto out;

Index: src/sys/external/bsd/drm2/dist/drm/drm_edid.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.1.1.1.2.10 src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.1.1.1.2.11
--- src/sys/external/bsd/drm2/dist/drm/drm_edid.c:1.1.1.1.2.10	Wed Jul 24 03:34:21 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_edid.c	Sun Sep  8 16:11:29 2013
@@ -440,16 +440,6 @@ EXPORT_SYMBOL(drm_get_edid);
  */
 static bool edid_vendor(struct edid *edid, char *vendor)
 {
-#ifdef __NetBSD__		/* XXX Avoid shadowing global definition.  */
-	char edidv[3];
-
-	edidv[0] = ((edid->mfg_id[0] & 0x7c) >> 2) + '@';
-	edidv[1] = (((edid->mfg_id[0] & 0x3) << 3) |
-			  ((edid->mfg_id[1] & 0xe0) >> 5)) + '@';
-	edidv[2] = (edid->mfg_id[1] & 0x1f) + '@';
-
-	return !strncmp(edidv, vendor, 3);
-#else
 	char edid_vendor[3];
 
 	edid_vendor[0] = ((edid->mfg_id[0] & 0x7c) >> 2) + '@';
@@ -458,7 +448,6 @@ static bool edid_vendor(struct edid *edi
 	edid_vendor[2] = (edid->mfg_id[1] & 0x1f) + '@';
 
 	return !strncmp(edid_vendor, vendor, 3);
-#endif
 }
 
 /**
@@ -1536,19 +1525,11 @@ EXPORT_SYMBOL(drm_find_cea_extension);
  */
 u8 drm_match_cea_mode(struct drm_display_mode *to_match)
 {
-#ifdef __NetBSD__
 	const struct drm_display_mode *cea_mode;
-#else
-	struct drm_display_mode *cea_mode;
-#endif
 	u8 mode;
 
 	for (mode = 0; mode < drm_num_cea_modes; mode++) {
-#ifdef __NetBSD__
 		cea_mode = &edid_cea_modes[mode];
-#else
-		cea_mode = (struct drm_display_mode *)&edid_cea_modes[mode];
-#endif
 
 		if (drm_mode_equal(to_match, cea_mode))
 			return mode + 1;

Index: src/sys/external/bsd/drm2/dist/drm/drm_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_gem.c:1.1.1.1.2.7 src/sys/external/bsd/drm2/dist/drm/drm_gem.c:1.1.1.1.2.8
--- src/sys/external/bsd/drm2/dist/drm/drm_gem.c:1.1.1.1.2.7	Wed Jul 24 02:53:07 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_gem.c	Sun Sep  8 16:11:29 2013
@@ -131,8 +131,8 @@ drm_gem_destroy(struct drm_device *dev)
 	kfree(mm);
 	dev->mm_private = NULL;
 
-#ifdef __NetBSD__
 	idr_destroy(&dev->object_name_idr);
+#ifdef __NetBSD__
 	spin_lock_destroy(&dev->object_name_lock);
 #endif
 }
@@ -215,12 +215,7 @@ drm_gem_object_alloc(struct drm_device *
 	}
 	return obj;
 fput:
-#ifdef __NetBSD__
 	drm_gem_object_release(obj);
-#else
-	/* Object_init mangles the global counters - readjust them. */
-	fput(obj->filp);
-#endif
 free:
 	kfree(obj);
 	return NULL;
@@ -274,7 +269,7 @@ drm_gem_handle_delete(struct drm_file *f
 	idr_remove(&filp->object_idr, handle);
 	spin_unlock(&filp->table_lock);
 
-#ifndef __NetBSD__
+#ifndef __NetBSD__			/* XXX drm prime */
 	drm_gem_remove_prime_handles(obj, filp);
 #endif
 

Index: src/sys/external/bsd/drm2/dist/drm/drm_global.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_global.c:1.1.1.1.2.5 src/sys/external/bsd/drm2/dist/drm/drm_global.c:1.1.1.1.2.6
--- src/sys/external/bsd/drm2/dist/drm/drm_global.c:1.1.1.1.2.5	Wed Jul 24 02:23:34 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_global.c	Sun Sep  8 16:11:29 2013
@@ -65,9 +65,7 @@ void drm_global_release(void)
 	int i;
 	for (i = 0; i < DRM_GLOBAL_NUM; ++i) {
 		struct drm_global_item *item = &glob[i];
-#ifdef __NetBSD__
 		(void)item;	/* ignore */
-#endif
 		BUG_ON(item->object != NULL);
 		BUG_ON(item->refcount != 0);
 	}

Index: src/sys/external/bsd/drm2/dist/drm/drm_irq.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_irq.c:1.1.1.1.2.9 src/sys/external/bsd/drm2/dist/drm/drm_irq.c:1.1.1.1.2.10
--- src/sys/external/bsd/drm2/dist/drm/drm_irq.c:1.1.1.1.2.9	Wed Jul 24 04:03:31 2013
+++ src/sys/external/bsd/drm2/dist/drm/drm_irq.c	Sun Sep  8 16:11:29 2013
@@ -346,11 +346,7 @@ int drm_irq_install(struct drm_device *d
 {
 	int ret;
 	unsigned long sh_flags = 0;
-#ifdef __NetBSD__
 	const char *irqname;
-#else
-	char *irqname;
-#endif
 
 	if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
 		return -EINVAL;

Index: src/sys/external/bsd/drm2/dist/include/drm/drmP.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.1.1.1.2.51 src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.1.1.1.2.52
--- src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.1.1.1.2.51	Sun Sep  8 15:41:07 2013
+++ src/sys/external/bsd/drm2/dist/include/drm/drmP.h	Sun Sep  8 16:11:29 2013
@@ -1091,15 +1091,9 @@ struct drm_driver {
 	int major;
 	int minor;
 	int patchlevel;
-#ifdef __NetBSD__
 	const char *name;
 	const char *desc;
 	const char *date;
-#else
-	char *name;
-	char *desc;
-	char *date;
-#endif
 
 	u32 driver_features;
 	int dev_priv_size;
@@ -1111,11 +1105,7 @@ struct drm_driver {
 		struct platform_device *platform_device;
 		struct usb_driver *usb;
 	} kdriver;
-#ifdef __NetBSD__		/* XXX const */
 	const struct drm_bus *bus;
-#else
-	struct drm_bus *bus;
-#endif
 
 	/* List of devices hanging off this driver */
 	struct list_head device_list;
@@ -1292,10 +1282,7 @@ struct drm_device {
 #endif
 	int last_checked;		/**< Last context checked for DMA */
 	int last_context;		/**< Last current context */
-#ifndef __NetBSD__
-	/* XXX Nobody seems to use this.  */
 	unsigned long last_switch;	/**< jiffies at last context switch */
-#endif
 	/*@} */
 
 	struct work_struct work;

Index: src/sys/external/bsd/drm2/dist/include/drm/drm_crtc.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drm_crtc.h:1.1.1.1.2.5 src/sys/external/bsd/drm2/dist/include/drm/drm_crtc.h:1.1.1.1.2.6
--- src/sys/external/bsd/drm2/dist/include/drm/drm_crtc.h:1.1.1.1.2.5	Wed Jul 24 03:40:29 2013
+++ src/sys/external/bsd/drm2/dist/include/drm/drm_crtc.h	Sun Sep  8 16:11:29 2013
@@ -114,7 +114,6 @@ enum drm_mode_status {
 #define DRM_MODE_TYPE_CLOCK_CRTC_C (DRM_MODE_TYPE_CLOCK_C | \
 				    DRM_MODE_TYPE_CRTC_C)
 
-#ifdef __NetBSD__
 #define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
 	.name = nm, .status = 0, .type = (t), .clock = (c), \
 	.hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
@@ -122,15 +121,6 @@ enum drm_mode_status {
 	.vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
 	.vscan = (vs), .flags = (f), .vrefresh = 0, \
 	.base = { .type = DRM_MODE_OBJECT_MODE }
-#else
-#define DRM_MODE(nm, t, c, hd, hss, hse, ht, hsk, vd, vss, vse, vt, vs, f) \
-	.name = nm, .status = 0, .type = (t), .clock = (c), \
-	.hdisplay = (hd), .hsync_start = (hss), .hsync_end = (hse), \
-	.htotal = (ht), .hskew = (hsk), .vdisplay = (vd), \
-	.vsync_start = (vss), .vsync_end = (vse), .vtotal = (vt), \
-	.vscan = (vs), .flags = (f), .vrefresh = 0, \
-	.base.type = DRM_MODE_OBJECT_MODE
-#endif
 
 #define CRTC_INTERLACE_HALVE_V 0x1 /* halve V values for interlacing */
 
@@ -849,11 +839,7 @@ struct drm_mode_config {
 
 struct drm_prop_enum_list {
 	int type;
-#ifdef __NetBSD__
 	const char *name;
-#else
-	char *name;
-#endif
 };
 
 extern int drm_crtc_init(struct drm_device *dev,
@@ -886,19 +872,11 @@ extern void drm_plane_cleanup(struct drm
 extern void drm_encoder_cleanup(struct drm_encoder *encoder);
 
 extern char *drm_get_connector_name(struct drm_connector *connector);
-#ifdef __NetBSD__
 extern const char *drm_get_dpms_name(int val);
 extern const char *drm_get_dvi_i_subconnector_name(int val);
 extern const char *drm_get_dvi_i_select_name(int val);
 extern const char *drm_get_tv_subconnector_name(int val);
 extern const char *drm_get_tv_select_name(int val);
-#else
-extern char *drm_get_dpms_name(int val);
-extern char *drm_get_dvi_i_subconnector_name(int val);
-extern char *drm_get_dvi_i_select_name(int val);
-extern char *drm_get_tv_subconnector_name(int val);
-extern char *drm_get_tv_select_name(int val);
-#endif
 extern void drm_fb_release(struct drm_file *file_priv);
 extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
 extern bool drm_probe_ddc(struct i2c_adapter *adapter);
@@ -983,13 +961,8 @@ extern void drm_property_destroy(struct 
 extern int drm_property_add_enum(struct drm_property *property, int index,
 				 uint64_t value, const char *name);
 extern int drm_mode_create_dvi_i_properties(struct drm_device *dev);
-#ifdef __NetBSD__		/* XXX const */
 extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
 				     const char *formats[]);
-#else
-extern int drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
-				     char *formats[]);
-#endif
 extern int drm_mode_create_scaling_mode_property(struct drm_device *dev);
 extern int drm_mode_create_dithering_property(struct drm_device *dev);
 extern int drm_mode_create_dirty_info_property(struct drm_device *dev);

Index: src/sys/external/bsd/drm2/dist/include/drm/drm_mm.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drm_mm.h:1.1.1.1.2.4 src/sys/external/bsd/drm2/dist/include/drm/drm_mm.h:1.1.1.1.2.5
--- src/sys/external/bsd/drm2/dist/include/drm/drm_mm.h:1.1.1.1.2.4	Wed Jul 24 00:52:04 2013
+++ src/sys/external/bsd/drm2/dist/include/drm/drm_mm.h	Sun Sep  8 16:11:29 2013
@@ -86,12 +86,10 @@ static inline bool drm_mm_node_allocated
 	return node->allocated;
 }
 
-#ifndef __NetBSD__
 static inline bool drm_mm_initialized(struct drm_mm *mm)
 {
 	return mm->hole_stack.next;
 }
-#endif
 
 #define drm_mm_for_each_node(entry, mm) list_for_each_entry(entry, \
 						&(mm)->head_node.node_list, \

Index: src/sys/modules/drm2/Makefile
diff -u src/sys/modules/drm2/Makefile:1.1.2.40 src/sys/modules/drm2/Makefile:1.1.2.41
--- src/sys/modules/drm2/Makefile:1.1.2.40	Sun Sep  8 15:57:54 2013
+++ src/sys/modules/drm2/Makefile	Sun Sep  8 16:11:29 2013
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1.2.40 2013/09/08 15:57:54 riastradh Exp $
+# $NetBSD: Makefile,v 1.1.2.41 2013/09/08 16:11:29 riastradh Exp $
 
 .include "../Makefile.inc"
 .include "Makefile.inc"
@@ -59,5 +59,6 @@ SRCS+=	linux_idr.c
 SRCS+=	linux_list_sort.c
 
 COPTS.drm_crtc.c+=	-Wno-shadow
+COPTS.drm_edid.c+=	-Wno-shadow
 
 .include <bsd.kmodule.mk>

Reply via email to