Skip to contentSkip to conversation

drm/nouveau: unify logging format with DRM core

PATCH New Pekka Paalanen 1 participant 2 messages Sep 20, 2009 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/nouveau: unify logging format with DRM core

Change NV_PRINTK() to use DRM_NAME and DRIVER_NAME, making it essentially generic. Print DRM_NAME in brackets, just like core DRM logging macros do.

Convert two printk()'s into NV_* logging macro calls.

---
 drivers/gpu/drm/nouveau/nouveau_acpi.c  |    2 +-
 drivers/gpu/drm/nouveau/nouveau_drv.h   |    8 ++++++--
 drivers/gpu/drm/nouveau/nouveau_fbcon.c |    6 ++++--
 3 files changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/nouveau/nouveau_acpi.c +1 -1
index f71789a..7fb7a9f 100644
@@ -95,7 +95,7 @@ int nouveau_hybrid_setup(struct drm_device *dev)
 		       &result))
 		return -ENODEV;
 
-	printk(KERN_INFO "nouveau: _DSM hardware status gave 0x%x\n", result);
+	NV_INFO(dev, "_DSM hardware status gave 0x%x\n", result);
 
 	if (result & 0x1) {	/* Stamina mode - disable the external GPU */
 		nvidia_dsm(pdev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_STAMINA,
drivers/gpu/drm/nouveau/nouveau_drv.h +6 -2
index 29cf085..a856099 100644
@@ -1151,9 +1151,13 @@ static inline void nv_wo32(struct drm_device *dev, struct nouveau_gpuobj *obj,
 	nv_wi32(dev, obj->im_pramin->start + index * 4, val);
 }
 
-/* logging */
+/*
+ * Logging
+ * Argument d is (struct drm_device *).
+ */
 #define NV_PRINTK(level, d, fmt, arg...) \
-	printk(level "nouveau %s: " fmt, pci_name(d->pdev), ##arg)
+	printk(level "[" DRM_NAME "] " DRIVER_NAME " %s: " fmt, \
+					pci_name(d->pdev), ##arg)
 #ifndef NV_DEBUG_NOTRACE
 #define NV_DEBUG(d, fmt, arg...) do {                                          \
 	if (drm_debug) {                                                       \
drivers/gpu/drm/nouveau/nouveau_fbcon.c +4 -2
index 3397a88..d6ac9b4 100644
@@ -309,8 +309,10 @@ nouveau_fbcon_create(struct drm_device *dev, uint32_t fb_width,
 	info->fbops->fb_fillrect(info, &rect);
 
 	/* To allow resizeing without swapping buffers */
-	printk("allocated %dx%d fb: 0x%lx, bo %p\n", nouveau_fb->base.width,
-	       nouveau_fb->base.height, nvbo->bo.offset, nvbo);
+	NV_INFO(dev, "allocated %dx%d fb: 0x%lx, bo %p\n",
+						nouveau_fb->base.width,
+						nouveau_fb->base.height,
+						nvbo->bo.offset, nvbo);
 
 	mutex_unlock(&dev->struct_mutex);
 	return 0;
Signature · 1 line
1.6.3.3

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 2/2 drm/nouveau: unify nouveau_acpi.c code with the driver style

Rename nvidia_dsm() to nouveau_dsm(), since everything else here is nouveau-something. Otherwise it might get mixed up with other nvidia drivers.

Use NV_ERROR() for the usual error report format. "nvidia-control" was very confusing when I first saw it in logs, I thought it was from a proprietary driver.

To be able to use NV_ERROR(), pass struct drm_device * as argument to nouveau_dsm() instead of struct pci_dev *. Also, 'dev' in nouveau code is usually a drm_device and pdev is a pci_dev, so fix that too.

---
 drivers/gpu/drm/nouveau/nouveau_acpi.c |   32 +++++++++++++++-----------------
 1 files changed, 15 insertions(+), 17 deletions(-)
drivers/gpu/drm/nouveau/nouveau_acpi.c +15 -17
index 7fb7a9f..ec0f2f3 100644
@@ -28,13 +28,14 @@
 #define NOUVEAU_DSM_POWER_SPEED 0x01
 #define NOUVEAU_DSM_POWER_STAMINA 0x02
 
-static int nvidia_dsm(struct pci_dev *dev, int func, int arg, int *result)
+static int nouveau_dsm(struct drm_device *dev, int func, int arg, int *result)
 {
 	static char muid[] = {
 		0xA0, 0xA0, 0x95, 0x9D, 0x60, 0x00, 0x48, 0x4D,
 		0xB3, 0x4D, 0x7E, 0x5F, 0xEA, 0x12, 0x9F, 0xD4,
 	};
 
+	struct pci_dev *pdev = dev->pdev;
 	struct acpi_handle *handle;
 	struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
 	struct acpi_object_list input;
@@ -42,7 +43,7 @@ static int nvidia_dsm(struct pci_dev *dev, int func, int arg, int *result)
 	union acpi_object *obj;
 	int err;
 
-	handle = DEVICE_ACPI_HANDLE(&dev->dev);
+	handle = DEVICE_ACPI_HANDLE(&pdev->dev);
 
 	if (!handle)
 		return -ENODEV;
@@ -61,8 +62,7 @@ static int nvidia_dsm(struct pci_dev *dev, int func, int arg, int *result)
 
 	err = acpi_evaluate_object(handle, "_DSM", &input, &output);
 	if (err) {
-		printk(KERN_ERR "nvidia-control: failed to evaluate _DSM: %d\n",
-		       err);
+		NV_ERROR(dev, "failed to evaluate _DSM: %d\n", err);
 		return err;
 	}
 
@@ -88,24 +88,23 @@ static int nvidia_dsm(struct pci_dev *dev, int func, int arg, int *result)
 
 int nouveau_hybrid_setup(struct drm_device *dev)
 {
-	struct pci_dev *pdev = dev->pdev;
 	int result;
 
-	if (nvidia_dsm(pdev, NOUVEAU_DSM_ACTIVE, NOUVEAU_DSM_ACTIVE_QUERY,
-		       &result))
+	if (nouveau_dsm(dev, NOUVEAU_DSM_ACTIVE, NOUVEAU_DSM_ACTIVE_QUERY,
+								&result))
 		return -ENODEV;
 
 	NV_INFO(dev, "_DSM hardware status gave 0x%x\n", result);
 
 	if (result & 0x1) {	/* Stamina mode - disable the external GPU */
-		nvidia_dsm(pdev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_STAMINA,
-			   NULL);
-		nvidia_dsm(pdev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_STAMINA,
-			   NULL);
+		nouveau_dsm(dev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_STAMINA,
+									NULL);
+		nouveau_dsm(dev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_STAMINA,
+									NULL);
 	} else {		/* Ensure that the external GPU is enabled */
-		nvidia_dsm(pdev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_SPEED, NULL);
-		nvidia_dsm(pdev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_SPEED,
-			   NULL);
+		nouveau_dsm(dev, NOUVEAU_DSM_LED, NOUVEAU_DSM_LED_SPEED, NULL);
+		nouveau_dsm(dev, NOUVEAU_DSM_POWER, NOUVEAU_DSM_POWER_SPEED,
+									NULL);
 	}
 
 	return 0;
@@ -113,11 +112,10 @@ int nouveau_hybrid_setup(struct drm_device *dev)
 
 bool nouveau_dsm_probe(struct drm_device *dev)
 {
-	struct pci_dev *pdev = dev->pdev;
 	int support = 0;
 
-	if (nvidia_dsm(pdev, NOUVEAU_DSM_SUPPORTED,
-		       NOUVEAU_DSM_SUPPORTED_FUNCTIONS, &support))
+	if (nouveau_dsm(dev, NOUVEAU_DSM_SUPPORTED,
+				NOUVEAU_DSM_SUPPORTED_FUNCTIONS, &support))
 		return false;
 
 	if (!support)
Signature · 1 line
1.6.3.3