Commit 77cd02c1 authored by David Howells's avatar David Howells Committed by Al Viro

fsl_udc: Don't use create_proc_read_entry()

Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Li Yang <leoli@freescale.com>
cc: Felipe Balbi <balbi@ti.com>
cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cc: linux-usb@vger.kernel.org
cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 96c7a22e
...@@ -2038,47 +2038,37 @@ static int fsl_udc_stop(struct usb_gadget *g, ...@@ -2038,47 +2038,37 @@ static int fsl_udc_stop(struct usb_gadget *g,
static const char proc_filename[] = "driver/fsl_usb2_udc"; static const char proc_filename[] = "driver/fsl_usb2_udc";
static int fsl_proc_read(char *page, char **start, off_t off, int count, static int fsl_proc_read(struct seq_file *m, void *v)
int *eof, void *_dev)
{ {
char *buf = page;
char *next = buf;
unsigned size = count;
unsigned long flags; unsigned long flags;
int t, i; int i;
u32 tmp_reg; u32 tmp_reg;
struct fsl_ep *ep = NULL; struct fsl_ep *ep = NULL;
struct fsl_req *req; struct fsl_req *req;
struct fsl_udc *udc = udc_controller; struct fsl_udc *udc = udc_controller;
if (off != 0)
return 0;
spin_lock_irqsave(&udc->lock, flags); spin_lock_irqsave(&udc->lock, flags);
/* ------basic driver information ---- */ /* ------basic driver information ---- */
t = scnprintf(next, size, seq_printf(m,
DRIVER_DESC "\n" DRIVER_DESC "\n"
"%s version: %s\n" "%s version: %s\n"
"Gadget driver: %s\n\n", "Gadget driver: %s\n\n",
driver_name, DRIVER_VERSION, driver_name, DRIVER_VERSION,
udc->driver ? udc->driver->driver.name : "(none)"); udc->driver ? udc->driver->driver.name : "(none)");
size -= t;
next += t;
/* ------ DR Registers ----- */ /* ------ DR Registers ----- */
tmp_reg = fsl_readl(&dr_regs->usbcmd); tmp_reg = fsl_readl(&dr_regs->usbcmd);
t = scnprintf(next, size, seq_printf(m,
"USBCMD reg:\n" "USBCMD reg:\n"
"SetupTW: %d\n" "SetupTW: %d\n"
"Run/Stop: %s\n\n", "Run/Stop: %s\n\n",
(tmp_reg & USB_CMD_SUTW) ? 1 : 0, (tmp_reg & USB_CMD_SUTW) ? 1 : 0,
(tmp_reg & USB_CMD_RUN_STOP) ? "Run" : "Stop"); (tmp_reg & USB_CMD_RUN_STOP) ? "Run" : "Stop");
size -= t;
next += t;
tmp_reg = fsl_readl(&dr_regs->usbsts); tmp_reg = fsl_readl(&dr_regs->usbsts);
t = scnprintf(next, size, seq_printf(m,
"USB Status Reg:\n" "USB Status Reg:\n"
"Dr Suspend: %d Reset Received: %d System Error: %s " "Dr Suspend: %d Reset Received: %d System Error: %s "
"USB Error Interrupt: %s\n\n", "USB Error Interrupt: %s\n\n",
...@@ -2086,11 +2076,9 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count, ...@@ -2086,11 +2076,9 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count,
(tmp_reg & USB_STS_RESET) ? 1 : 0, (tmp_reg & USB_STS_RESET) ? 1 : 0,
(tmp_reg & USB_STS_SYS_ERR) ? "Err" : "Normal", (tmp_reg & USB_STS_SYS_ERR) ? "Err" : "Normal",
(tmp_reg & USB_STS_ERR) ? "Err detected" : "No err"); (tmp_reg & USB_STS_ERR) ? "Err detected" : "No err");
size -= t;
next += t;
tmp_reg = fsl_readl(&dr_regs->usbintr); tmp_reg = fsl_readl(&dr_regs->usbintr);
t = scnprintf(next, size, seq_printf(m,
"USB Interrupt Enable Reg:\n" "USB Interrupt Enable Reg:\n"
"Sleep Enable: %d SOF Received Enable: %d " "Sleep Enable: %d SOF Received Enable: %d "
"Reset Enable: %d\n" "Reset Enable: %d\n"
...@@ -2104,33 +2092,25 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count, ...@@ -2104,33 +2092,25 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count,
(tmp_reg & USB_INTR_PTC_DETECT_EN) ? 1 : 0, (tmp_reg & USB_INTR_PTC_DETECT_EN) ? 1 : 0,
(tmp_reg & USB_INTR_ERR_INT_EN) ? 1 : 0, (tmp_reg & USB_INTR_ERR_INT_EN) ? 1 : 0,
(tmp_reg & USB_INTR_INT_EN) ? 1 : 0); (tmp_reg & USB_INTR_INT_EN) ? 1 : 0);
size -= t;
next += t;
tmp_reg = fsl_readl(&dr_regs->frindex); tmp_reg = fsl_readl(&dr_regs->frindex);
t = scnprintf(next, size, seq_printf(m,
"USB Frame Index Reg: Frame Number is 0x%x\n\n", "USB Frame Index Reg: Frame Number is 0x%x\n\n",
(tmp_reg & USB_FRINDEX_MASKS)); (tmp_reg & USB_FRINDEX_MASKS));
size -= t;
next += t;
tmp_reg = fsl_readl(&dr_regs->deviceaddr); tmp_reg = fsl_readl(&dr_regs->deviceaddr);
t = scnprintf(next, size, seq_printf(m,
"USB Device Address Reg: Device Addr is 0x%x\n\n", "USB Device Address Reg: Device Addr is 0x%x\n\n",
(tmp_reg & USB_DEVICE_ADDRESS_MASK)); (tmp_reg & USB_DEVICE_ADDRESS_MASK));
size -= t;
next += t;
tmp_reg = fsl_readl(&dr_regs->endpointlistaddr); tmp_reg = fsl_readl(&dr_regs->endpointlistaddr);
t = scnprintf(next, size, seq_printf(m,
"USB Endpoint List Address Reg: " "USB Endpoint List Address Reg: "
"Device Addr is 0x%x\n\n", "Device Addr is 0x%x\n\n",
(tmp_reg & USB_EP_LIST_ADDRESS_MASK)); (tmp_reg & USB_EP_LIST_ADDRESS_MASK));
size -= t;
next += t;
tmp_reg = fsl_readl(&dr_regs->portsc1); tmp_reg = fsl_readl(&dr_regs->portsc1);
t = scnprintf(next, size, seq_printf(m,
"USB Port Status&Control Reg:\n" "USB Port Status&Control Reg:\n"
"Port Transceiver Type : %s Port Speed: %s\n" "Port Transceiver Type : %s Port Speed: %s\n"
"PHY Low Power Suspend: %s Port Reset: %s " "PHY Low Power Suspend: %s Port Reset: %s "
...@@ -2139,7 +2119,7 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count, ...@@ -2139,7 +2119,7 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count,
"Port Enable/Disable Change: %s\n" "Port Enable/Disable Change: %s\n"
"Port Enabled/Disabled: %s " "Port Enabled/Disabled: %s "
"Current Connect Status: %s\n\n", ( { "Current Connect Status: %s\n\n", ( {
char *s; const char *s;
switch (tmp_reg & PORTSCX_PTS_FSLS) { switch (tmp_reg & PORTSCX_PTS_FSLS) {
case PORTSCX_PTS_UTMI: case PORTSCX_PTS_UTMI:
s = "UTMI"; break; s = "UTMI"; break;
...@@ -2165,13 +2145,11 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count, ...@@ -2165,13 +2145,11 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count,
"Not correct", "Not correct",
(tmp_reg & PORTSCX_CURRENT_CONNECT_STATUS) ? (tmp_reg & PORTSCX_CURRENT_CONNECT_STATUS) ?
"Attached" : "Not-Att"); "Attached" : "Not-Att");
size -= t;
next += t;
tmp_reg = fsl_readl(&dr_regs->usbmode); tmp_reg = fsl_readl(&dr_regs->usbmode);
t = scnprintf(next, size, seq_printf(m,
"USB Mode Reg: Controller Mode is: %s\n\n", ( { "USB Mode Reg: Controller Mode is: %s\n\n", ( {
char *s; const char *s;
switch (tmp_reg & USB_MODE_CTRL_MODE_HOST) { switch (tmp_reg & USB_MODE_CTRL_MODE_HOST) {
case USB_MODE_CTRL_MODE_IDLE: case USB_MODE_CTRL_MODE_IDLE:
s = "Idle"; break; s = "Idle"; break;
...@@ -2184,103 +2162,87 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count, ...@@ -2184,103 +2162,87 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count,
} }
s; s;
} )); } ));
size -= t;
next += t;
tmp_reg = fsl_readl(&dr_regs->endptsetupstat); tmp_reg = fsl_readl(&dr_regs->endptsetupstat);
t = scnprintf(next, size, seq_printf(m,
"Endpoint Setup Status Reg: SETUP on ep 0x%x\n\n", "Endpoint Setup Status Reg: SETUP on ep 0x%x\n\n",
(tmp_reg & EP_SETUP_STATUS_MASK)); (tmp_reg & EP_SETUP_STATUS_MASK));
size -= t;
next += t;
for (i = 0; i < udc->max_ep / 2; i++) { for (i = 0; i < udc->max_ep / 2; i++) {
tmp_reg = fsl_readl(&dr_regs->endptctrl[i]); tmp_reg = fsl_readl(&dr_regs->endptctrl[i]);
t = scnprintf(next, size, "EP Ctrl Reg [0x%x]: = [0x%x]\n", seq_printf(m, "EP Ctrl Reg [0x%x]: = [0x%x]\n", i, tmp_reg);
i, tmp_reg);
size -= t;
next += t;
} }
tmp_reg = fsl_readl(&dr_regs->endpointprime); tmp_reg = fsl_readl(&dr_regs->endpointprime);
t = scnprintf(next, size, "EP Prime Reg = [0x%x]\n\n", tmp_reg); seq_printf(m, "EP Prime Reg = [0x%x]\n\n", tmp_reg);
size -= t;
next += t;
#ifndef CONFIG_ARCH_MXC #ifndef CONFIG_ARCH_MXC
if (udc->pdata->have_sysif_regs) { if (udc->pdata->have_sysif_regs) {
tmp_reg = usb_sys_regs->snoop1; tmp_reg = usb_sys_regs->snoop1;
t = scnprintf(next, size, "Snoop1 Reg : = [0x%x]\n\n", tmp_reg); seq_printf(m, "Snoop1 Reg : = [0x%x]\n\n", tmp_reg);
size -= t;
next += t;
tmp_reg = usb_sys_regs->control; tmp_reg = usb_sys_regs->control;
t = scnprintf(next, size, "General Control Reg : = [0x%x]\n\n", seq_printf(m, "General Control Reg : = [0x%x]\n\n", tmp_reg);
tmp_reg);
size -= t;
next += t;
} }
#endif #endif
/* ------fsl_udc, fsl_ep, fsl_request structure information ----- */ /* ------fsl_udc, fsl_ep, fsl_request structure information ----- */
ep = &udc->eps[0]; ep = &udc->eps[0];
t = scnprintf(next, size, "For %s Maxpkt is 0x%x index is 0x%x\n", seq_printf(m, "For %s Maxpkt is 0x%x index is 0x%x\n",
ep->ep.name, ep_maxpacket(ep), ep_index(ep)); ep->ep.name, ep_maxpacket(ep), ep_index(ep));
size -= t;
next += t;
if (list_empty(&ep->queue)) { if (list_empty(&ep->queue)) {
t = scnprintf(next, size, "its req queue is empty\n\n"); seq_puts(m, "its req queue is empty\n\n");
size -= t;
next += t;
} else { } else {
list_for_each_entry(req, &ep->queue, queue) { list_for_each_entry(req, &ep->queue, queue) {
t = scnprintf(next, size, seq_printf(m,
"req %p actual 0x%x length 0x%x buf %p\n", "req %p actual 0x%x length 0x%x buf %p\n",
&req->req, req->req.actual, &req->req, req->req.actual,
req->req.length, req->req.buf); req->req.length, req->req.buf);
size -= t;
next += t;
} }
} }
/* other gadget->eplist ep */ /* other gadget->eplist ep */
list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) { list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) {
if (ep->ep.desc) { if (ep->ep.desc) {
t = scnprintf(next, size, seq_printf(m,
"\nFor %s Maxpkt is 0x%x " "\nFor %s Maxpkt is 0x%x "
"index is 0x%x\n", "index is 0x%x\n",
ep->ep.name, ep_maxpacket(ep), ep->ep.name, ep_maxpacket(ep),
ep_index(ep)); ep_index(ep));
size -= t;
next += t;
if (list_empty(&ep->queue)) { if (list_empty(&ep->queue)) {
t = scnprintf(next, size, seq_puts(m, "its req queue is empty\n\n");
"its req queue is empty\n\n");
size -= t;
next += t;
} else { } else {
list_for_each_entry(req, &ep->queue, queue) { list_for_each_entry(req, &ep->queue, queue) {
t = scnprintf(next, size, seq_printf(m,
"req %p actual 0x%x length " "req %p actual 0x%x length "
"0x%x buf %p\n", "0x%x buf %p\n",
&req->req, req->req.actual, &req->req, req->req.actual,
req->req.length, req->req.buf); req->req.length, req->req.buf);
size -= t; } /* end for each_entry of ep req */
next += t; } /* end for else */
} /* end for each_entry of ep req */ } /* end for if(ep->queue) */
} /* end for else */ } /* end (ep->desc) */
} /* end for if(ep->queue) */
} /* end (ep->desc) */
spin_unlock_irqrestore(&udc->lock, flags); spin_unlock_irqrestore(&udc->lock, flags);
return 0;
}
*eof = 1; /*
return count - size; * seq_file wrappers for procfile show routines.
*/
static int fsl_proc_open(struct inode *inode, struct file *file)
{
return single_open(file, fsl_proc_read, NULL);
} }
#define create_proc_file() create_proc_read_entry(proc_filename, \ static const struct file_operations fsl_proc_fops = {
0, NULL, fsl_proc_read, NULL) .open = fsl_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
#define create_proc_file() proc_create(proc_filename, 0, NULL, &fsl_proc_fops)
#define remove_proc_file() remove_proc_entry(proc_filename, NULL) #define remove_proc_file() remove_proc_entry(proc_filename, NULL)
#else /* !CONFIG_USB_GADGET_DEBUG_FILES */ #else /* !CONFIG_USB_GADGET_DEBUG_FILES */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment