11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* 21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Compaq Hot Plug Controller Driver 31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Copyright (C) 1995,2001 Compaq Computer Corporation 51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Copyright (C) 2001,2003 Greg Kroah-Hartman (greg@kroah.com) 61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Copyright (C) 2001 IBM Corp. 71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * All rights reserved. 91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This program is free software; you can redistribute it and/or modify 111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * it under the terms of the GNU General Public License as published by 121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * the Free Software Foundation; either version 2 of the License, or (at 131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * your option) any later version. 141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * This program is distributed in the hope that it will be useful, but 161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * WITHOUT ANY WARRANTY; without even the implied warranty of 171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * NON INFRINGEMENT. See the GNU General Public License for more 191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * details. 201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * You should have received a copy of the GNU General Public License 221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * along with this program; if not, write to the Free Software 231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * Send feedback to <greg@kroah.com> 261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds * 271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds */ 281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/module.h> 301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/kernel.h> 315a0e3ad6af8660be21ca98a971cd00f331318c05Tejun Heo#include <linux/slab.h> 321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/types.h> 331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/proc_fs.h> 341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/workqueue.h> 351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include <linux/pci.h> 367a54f25cef6c763f16c9fd49ae382de162147873Greg Kroah-Hartman#include <linux/pci_hotplug.h> 37613655fa39ff6957754fa8ceb8559980920eb8eeArnd Bergmann#include <linux/mutex.h> 389f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman#include <linux/debugfs.h> 391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#include "cpqphp.h" 401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 41613655fa39ff6957754fa8ceb8559980920eb8eeArnd Bergmannstatic DEFINE_MUTEX(cpqphp_mutex); 429f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanstatic int show_ctrl (struct controller *ctrl, char *buf) 431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 449f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman char *out = buf; 451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int index; 461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct pci_resource *res; 471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(buf, "Free resources: memory\n"); 491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds index = 11; 501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = ctrl->mem_head; 511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds while (res && index--) { 521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length); 531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = res->next; 541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "Free resources: prefetchable memory\n"); 561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds index = 11; 571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = ctrl->p_mem_head; 581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds while (res && index--) { 591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length); 601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = res->next; 611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "Free resources: IO\n"); 631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds index = 11; 641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = ctrl->io_head; 651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds while (res && index--) { 661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length); 671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = res->next; 681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "Free resources: bus numbers\n"); 701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds index = 11; 711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = ctrl->bus_head; 721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds while (res && index--) { 731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length); 741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = res->next; 751da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return out - buf; 781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 809f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanstatic int show_dev (struct controller *ctrl, char *buf) 811da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 823c78bc61f5ef3bc87e7f94f67ec737d2273f120bRyan Desfosses char *out = buf; 831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds int index; 841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct pci_resource *res; 851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct pci_func *new_slot; 861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds struct slot *slot; 871da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 889f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman slot = ctrl->slot; 891da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 901da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds while (slot) { 911da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds new_slot = cpqhp_slot_find(slot->bus, slot->device, 0); 921da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds if (!new_slot) 931da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds break; 941da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "assigned resources: memory\n"); 951da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds index = 11; 961da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = new_slot->mem_head; 971da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds while (res && index--) { 981da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length); 991da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = res->next; 1001da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1011da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "assigned resources: prefetchable memory\n"); 1021da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds index = 11; 1031da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = new_slot->p_mem_head; 1041da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds while (res && index--) { 1051da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length); 1061da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = res->next; 1071da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1081da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "assigned resources: IO\n"); 1091da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds index = 11; 1101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = new_slot->io_head; 1111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds while (res && index--) { 1121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length); 1131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = res->next; 1141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "assigned resources: bus numbers\n"); 1161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds index = 11; 1171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = new_slot->bus_head; 1181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds while (res && index--) { 1191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length); 1201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds res = res->next; 1211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds slot=slot->next; 1231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds } 1241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds return out - buf; 1261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 1271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds 1289f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanstatic int spew_debug_info(struct controller *ctrl, char *data, int size) 1291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds{ 1309f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman int used; 1319f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 1329f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman used = size - show_ctrl(ctrl, data); 1339f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman used = (size - used) - show_dev(ctrl, &data[used]); 1349f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman return used; 1359f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman} 1369f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 1379f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanstruct ctrl_dbg { 1389f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman int size; 1399f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman char *data; 1409f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman struct controller *ctrl; 1419f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman}; 1429f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 1439f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman#define MAX_OUTPUT (4*PAGE_SIZE) 1449f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 1459f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanstatic int open(struct inode *inode, struct file *file) 1469f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman{ 1478e18e2941c53416aa219708e7dcad21fb4bd6794Theodore Ts'o struct controller *ctrl = inode->i_private; 1489f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman struct ctrl_dbg *dbg; 1499f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman int retval = -ENOMEM; 1509f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 151613655fa39ff6957754fa8ceb8559980920eb8eeArnd Bergmann mutex_lock(&cpqphp_mutex); 1529f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman dbg = kmalloc(sizeof(*dbg), GFP_KERNEL); 1539f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman if (!dbg) 1549f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman goto exit; 1559f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman dbg->data = kmalloc(MAX_OUTPUT, GFP_KERNEL); 1569f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman if (!dbg->data) { 1579f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman kfree(dbg); 1589f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman goto exit; 1599f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman } 1609f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman dbg->size = spew_debug_info(ctrl, dbg->data, MAX_OUTPUT); 1619f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman file->private_data = dbg; 1629f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman retval = 0; 1639f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanexit: 164613655fa39ff6957754fa8ceb8559980920eb8eeArnd Bergmann mutex_unlock(&cpqphp_mutex); 1659f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman return retval; 1669f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman} 1679f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 1689f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanstatic loff_t lseek(struct file *file, loff_t off, int whence) 1699f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman{ 170d2c40f789f6c98c50bf01cf84ef46415fb7a2776Al Viro struct ctrl_dbg *dbg = file->private_data; 171d2c40f789f6c98c50bf01cf84ef46415fb7a2776Al Viro return fixed_size_llseek(file, off, whence, dbg->size); 1721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds} 1739f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 1749f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanstatic ssize_t read(struct file *file, char __user *buf, 1759f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman size_t nbytes, loff_t *ppos) 1769f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman{ 1779f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman struct ctrl_dbg *dbg = file->private_data; 1789f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman return simple_read_from_buffer(buf, nbytes, ppos, dbg->data, dbg->size); 1799f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman} 1809f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 1819f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanstatic int release(struct inode *inode, struct file *file) 1829f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman{ 1839f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman struct ctrl_dbg *dbg = file->private_data; 1849f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 1859f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman kfree(dbg->data); 1869f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman kfree(dbg); 1879f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman return 0; 1889f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman} 1899f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 190d54b1fdb1d9f82e375a299e22bd366aad52d4c34Arjan van de Venstatic const struct file_operations debug_ops = { 1919f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman .owner = THIS_MODULE, 1929f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman .open = open, 1939f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman .llseek = lseek, 1949f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman .read = read, 1959f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman .release = release, 1969f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman}; 1979f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 1989f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanstatic struct dentry *root; 1999f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 2009f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanvoid cpqhp_initialize_debugfs(void) 2019f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman{ 2029f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman if (!root) 2039f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman root = debugfs_create_dir("cpqhp", NULL); 2049f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman} 2059f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 2069f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanvoid cpqhp_shutdown_debugfs(void) 2079f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman{ 2089f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman debugfs_remove(root); 2099f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman} 2109f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 2119f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanvoid cpqhp_create_debugfs_files(struct controller *ctrl) 2129f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman{ 21354cc6954a431dad42fb73e0a50b6d318a70594f6Kay Sievers ctrl->dentry = debugfs_create_file(dev_name(&ctrl->pci_dev->dev), 21454cc6954a431dad42fb73e0a50b6d318a70594f6Kay Sievers S_IRUGO, root, ctrl, &debug_ops); 2159f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman} 2169f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 2179f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartmanvoid cpqhp_remove_debugfs_files(struct controller *ctrl) 2189f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman{ 2195d37818b9ccbec660abb3a11d4ffb0aba0e3c809Fabian Frederick debugfs_remove(ctrl->dentry); 2209f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman ctrl->dentry = NULL; 2219f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman} 2229f3f4681291fc88864bb27f8f3832b95bb53aae5Greg Kroah-Hartman 223