Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c8942f9 authored by Rajesh Shah's avatar Rajesh Shah Committed by Greg Kroah-Hartman
Browse files

[PATCH] shpchp: reduce debug message verbosity



Reduce the number of debug messages generated if shpchp debug is
enabled. I tried to restrict this to removing debug messages that
are either early-driver-debug type messages, or print information
that can be inferred through other debug prints.

Signed-off-by: default avatarRajesh Shah <rajesh.shah@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ee138334
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -293,12 +293,9 @@ static inline struct slot *shpchp_find_slot (struct controller *ctrl, u8 device)

	p_slot = ctrl->slot;

	dbg("p_slot = %p\n", p_slot);

	while (p_slot && (p_slot->device != device)) {
		tmp_slot = p_slot;
		p_slot = p_slot->next;
		dbg("In while loop, p_slot = %p\n", p_slot);
	}
	if (p_slot == NULL) {
		err("ERROR: shpchp_find_slot device=0x%x\n", device);
@@ -313,8 +310,6 @@ static inline int wait_for_ctrl_irq (struct controller *ctrl)
    DECLARE_WAITQUEUE(wait, current);
	int retval = 0;

	dbg("%s : start\n",__FUNCTION__);

	add_wait_queue(&ctrl->queue, &wait);

	if (!shpchp_poll_mode) {
@@ -328,7 +323,6 @@ static inline int wait_for_ctrl_irq (struct controller *ctrl)
	if (signal_pending(current))
		retval =  -EINTR;

	dbg("%s : end\n", __FUNCTION__);
	return retval;
}

+0 −8
Original line number Diff line number Diff line
@@ -105,8 +105,6 @@ static int init_slots(struct controller *ctrl)
	u32 slot_number, sun;
	int result = -ENOMEM;

	dbg("%s\n",__FUNCTION__);

	number_of_slots = ctrl->num_slots;
	slot_device = ctrl->slot_device_offset;
	slot_number = ctrl->first_slot;
@@ -373,15 +371,12 @@ static int shpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
	}
	memset(ctrl, 0, sizeof(struct controller));

	dbg("DRV_thread pid = %d\n", current->pid);

	rc = shpc_init(ctrl, pdev);
	if (rc) {
		dbg("%s: controller initialization failed\n", SHPC_MODULE_NAME);
		goto err_out_free_ctrl;
	}

	dbg("%s: controller initialization success\n", __FUNCTION__);
	ctrl->pci_dev = pdev;  /* pci_dev of the P2P bridge */

	pci_set_drvdata(pdev, ctrl);
@@ -488,8 +483,6 @@ static void __exit unload_shpchpd(void)
		cleanup_slots(ctrl);

		kfree (ctrl->pci_bus);

		dbg("%s: calling release_ctlr\n", __FUNCTION__);
		ctrl->hpc_ops->release_ctlr(ctrl);

		tctrl = ctrl;
@@ -558,7 +551,6 @@ static void __exit shpcd_cleanup(void)
	dbg("unload_shpchpd()\n");
	unload_shpchpd();

	dbg("pci_unregister_driver\n");
	pci_unregister_driver(&shpc_driver);

	info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
+0 −11
Original line number Diff line number Diff line
@@ -505,9 +505,7 @@ static int board_added(struct slot *p_slot)
	up(&ctrl->crit_sect);

	/* Wait for ~1 second */
	dbg("%s: before long_delay\n", __FUNCTION__);
	wait_for_ctrl_irq (ctrl);
	dbg("%s: after long_delay\n", __FUNCTION__);

	dbg("%s: slot status = %x\n", __FUNCTION__, p_slot->status);
	/* Check for a power fault */
@@ -666,13 +664,11 @@ static void shpchp_pushbutton_thread (unsigned long slot)
	p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
	if (getstatus) {
		p_slot->state = POWEROFF_STATE;
		dbg("In power_down_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);

		shpchp_disable_slot(p_slot);
		p_slot->state = STATIC_STATE;
	} else {
		p_slot->state = POWERON_STATE;
		dbg("In add_board, b:d(%x:%x)\n", p_slot->bus, p_slot->device);

		if (shpchp_enable_slot(p_slot)) {
			/* Wait for exclusive access to hardware */
@@ -734,7 +730,6 @@ int shpchp_event_start_thread (void)
		err ("Can't start up our event thread\n");
		return -1;
	}
	dbg("Our event thread pid = %d\n", pid);
	return 0;
}

@@ -742,9 +737,7 @@ int shpchp_event_start_thread (void)
void shpchp_event_stop_thread (void)
{
	event_finished = 1;
	dbg("event_thread finish command given\n");
	up(&event_semaphore);
	dbg("wait for event_thread to exit\n");
	down(&event_exit);
}

@@ -776,7 +769,6 @@ static void interrupt_event_handler(struct controller *ctrl)
	u8 getstatus;
	struct slot *p_slot;

	dbg("%s:\n", __FUNCTION__);
	while (change) {
		change = 0;

@@ -788,9 +780,6 @@ static void interrupt_event_handler(struct controller *ctrl)

				p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset);

				dbg("%s: hp_slot %d, p_slot %p\n",
						__FUNCTION__, hp_slot, p_slot);

				if (ctrl->event_queue[loop].event_type == INT_BUTTON_CANCEL) {
					dbg("%s: button cancel\n", __FUNCTION__);
					del_timer(&p_slot->task_event);
+7 −40
Original line number Diff line number Diff line
@@ -313,7 +313,6 @@ static int shpc_write_cmd(struct slot *slot, u8 t_slot, u8 cmd)
	 * command. 
	 */
	writew(temp_word, php_ctlr->creg + CMD);
	dbg("%s: temp_word written %x\n", __FUNCTION__, temp_word);

	DBG_LEAVE_ROUTINE 
	return retval;
@@ -789,10 +788,8 @@ static void hpc_release_ctlr(struct controller *ctrl)
		}
	}
	if (php_ctlr->pci_dev) {
		dbg("%s: before calling iounmap & release_mem_region\n", __FUNCTION__);
		iounmap(php_ctlr->creg);
		release_mem_region(pci_resource_start(php_ctlr->pci_dev, 0), pci_resource_len(php_ctlr->pci_dev, 0));
		dbg("%s: before calling iounmap & release_mem_region\n", __FUNCTION__);
		php_ctlr->pci_dev = NULL;
	}

@@ -1043,18 +1040,13 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)

	if (!intr_loc)
		return IRQ_NONE;
	dbg("%s: shpc_isr proceeds\n", __FUNCTION__);
	dbg("%s: intr_loc = %x\n",__FUNCTION__, intr_loc); 

	if(!shpchp_poll_mode) {
		/* Mask Global Interrupt Mask - see implementation note on p. 139 */
		/* of SHPC spec rev 1.0*/
		temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE);
		dbg("%s: Before masking global interrupt, temp_dword = %x\n",
			__FUNCTION__, temp_dword); 
		temp_dword |= 0x00000001;
		dbg("%s: After masking global interrupt, temp_dword = %x\n",
			__FUNCTION__, temp_dword); 
		writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE);

		intr_loc2 = readl(php_ctlr->creg + INTR_LOC);  
@@ -1068,11 +1060,7 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
		 * Detect bit in Controller SERR-INT register
		 */
		temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE);
		dbg("%s: Before clearing CCIP, temp_dword = %x\n",
			__FUNCTION__, temp_dword); 
		temp_dword &= 0xfffeffff;
		dbg("%s: After clearing CCIP, temp_dword = %x\n",
			__FUNCTION__, temp_dword); 
		writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE);
		wake_up_interruptible(&ctrl->queue);
	}
@@ -1080,11 +1068,7 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
	if ((intr_loc = (intr_loc >> 1)) == 0) {
		/* Unmask Global Interrupt Mask */
		temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE);
		dbg("%s: 1-Before unmasking global interrupt, temp_dword = %x\n",
			__FUNCTION__, temp_dword); 
		temp_dword &= 0xfffffffe;
		dbg("%s: 1-After unmasking global interrupt, temp_dword = %x\n",
			__FUNCTION__, temp_dword); 
		writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE);

		return IRQ_NONE;
@@ -1094,11 +1078,9 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
	/* To find out which slot has interrupt pending */
		if ((intr_loc >> hp_slot) & 0x01) {
			temp_dword = readl(php_ctlr->creg + SLOT1 + (4*hp_slot));
			dbg("%s: Slot %x with intr, temp_dword = %x\n",
			dbg("%s: Slot %x with intr, slot register = %x\n",
				__FUNCTION__, hp_slot, temp_dword);
			temp_byte = (temp_dword >> 16) & 0xFF;
			dbg("%s: Slot with intr, temp_byte = %x\n",
				__FUNCTION__, temp_byte); 
			if ((php_ctlr->switch_change_callback) && (temp_byte & 0x08))
				schedule_flag += php_ctlr->switch_change_callback(
					hp_slot, php_ctlr->callback_instance_id);
@@ -1114,8 +1096,6 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
			
			/* Clear all slot events */
			temp_dword = 0xe01f3fff;
			dbg("%s: Clearing slot events, temp_dword = %x\n",
				__FUNCTION__, temp_dword); 
			writel(temp_dword, php_ctlr->creg + SLOT1 + (4*hp_slot));

			intr_loc2 = readl(php_ctlr->creg + INTR_LOC);  
@@ -1125,11 +1105,7 @@ static irqreturn_t shpc_isr(int IRQ, void *dev_id, struct pt_regs *regs)
	if (!shpchp_poll_mode) {
		/* Unmask Global Interrupt Mask */
		temp_dword = readl(php_ctlr->creg + SERR_INTR_ENABLE);
		dbg("%s: 2-Before unmasking global interrupt, temp_dword = %x\n",
			__FUNCTION__, temp_dword); 
		temp_dword &= 0xfffffffe;
		dbg("%s: 2-After unmasking global interrupt, temp_dword = %x\n",
			__FUNCTION__, temp_dword); 
		writel(temp_dword, php_ctlr->creg + SERR_INTR_ENABLE);
	}
	
@@ -1402,7 +1378,8 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
				err("%s : pci_read_config_dword failed\n", __FUNCTION__);
				goto abort_free_ctlr;
			}
			dbg("%s: offset %d: tempdword %x\n", __FUNCTION__,i, tempdword);
			dbg("%s: offset %d: value %x\n", __FUNCTION__,i,
					tempdword);
		}
	}

@@ -1411,13 +1388,6 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
		first = 0;
	}

	dbg("pdev = %p: b:d:f:irq=0x%x:%x:%x:%x\n", pdev, pdev->bus->number, PCI_SLOT(pdev->devfn), 
		PCI_FUNC(pdev->devfn), pdev->irq);
	for ( rc = 0; rc < DEVICE_COUNT_RESOURCE; rc++)
		if (pci_resource_len(pdev, rc) > 0)
			dbg("pci resource[%d] start=0x%lx(len=0x%lx), shpc_base_offset %x\n", rc,
				pci_resource_start(pdev, rc), pci_resource_len(pdev, rc), shpc_base_offset);

	info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor, 
		pdev->subsystem_device);
	
@@ -1437,7 +1407,6 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
		goto abort_free_ctlr;
	}
	dbg("%s: php_ctlr->creg %p\n", __FUNCTION__, php_ctlr->creg);
	dbg("%s: physical addr %p\n", __FUNCTION__, (void*)pci_resource_start(pdev, 0));

	init_MUTEX(&ctrl->crit_sect);
	/* Setup wait queue */
@@ -1445,8 +1414,6 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)

	/* Find the IRQ */
	php_ctlr->irq = pdev->irq;
	dbg("HPC interrupt = %d\n", php_ctlr->irq);

	php_ctlr->attention_button_callback = shpchp_handle_attention_button,
	php_ctlr->switch_change_callback = shpchp_handle_switch_change;
	php_ctlr->presence_change_callback = shpchp_handle_presence_change;
@@ -1488,7 +1455,6 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
		if (rc) {
			info("Can't get msi for the hotplug controller\n");
			info("Use INTx for the hotplug controller\n");
			dbg("%s: rc = %x\n", __FUNCTION__, rc);
		} else
			php_ctlr->irq = pdev->irq;
		
@@ -1499,8 +1465,10 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
			goto abort_free_ctlr;
		}
	}
	dbg("%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n", __FUNCTION__,
			pdev->bus->number, PCI_SLOT(pdev->devfn),
			PCI_FUNC(pdev->devfn), pdev->irq);
	get_hp_hw_control_from_firmware(pdev);
	dbg("%s: Before adding HPC to HPC list\n", __FUNCTION__);

	/*  Add this HPC instance into the HPC list */
	spin_lock(&list_lock);
@@ -1539,7 +1507,6 @@ int shpc_init(struct controller * ctrl, struct pci_dev * pdev)
		dbg("%s: SERR_INTR_ENABLE = %x\n", __FUNCTION__, tempdword);
	}

	dbg("%s: Leaving shpc_init\n", __FUNCTION__);
	DBG_LEAVE_ROUTINE
	return 0;