Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

firewire: nosy: misc cleanups

Extend copyright note to 2007, c.f. Kristian's git log.

Includes:
- replace some <asm/*.h> by <linux/*.h>
- add required indirectly included <linux/spinlock.h>
- order alphabetically

Coding style related changes:
- change to utf8
- normalize whitespace
- normalize comment style
- remove usages of __FUNCTION__
- remove an unnecessary cast from void *

Const and static declarations:
- driver_name is not const in pci_driver.name, drop const qualifier
- driver_name can be taken from KBUILD_MODNAME
- the global variable minors[] can and should be static
- constify struct file_operations instance

Data types:
- Remove unused struct member struct packet.code. struct packet is
only used for driver-internal bookkeeping; it does not appear on the
wire or in DMA programs or the userspace ABI. Hence the unused
member .code can be removed without worries.

Preprocessor macros:
- unroll a preprocessor macro that containd a return
- use list_for_each_entry

Printk:
- add missing terminating \n in some format strings

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

+169 -186
+5 -5
drivers/firewire/nosy-user.h
··· 1 1 #ifndef __nosy_user_h 2 2 #define __nosy_user_h 3 3 4 - #include <asm/ioctl.h> 5 - #include <asm/types.h> 4 + #include <linux/ioctl.h> 5 + #include <linux/types.h> 6 6 7 7 #define NOSY_IOC_GET_STATS _IOR('&', 0, struct nosy_stats) 8 8 #define NOSY_IOC_START _IO('&', 1) ··· 10 10 #define NOSY_IOC_FILTER _IOW('&', 2, __u32) 11 11 12 12 struct nosy_stats { 13 - __u32 total_packet_count; 14 - __u32 lost_packet_count; 13 + __u32 total_packet_count; 14 + __u32 lost_packet_count; 15 15 }; 16 16 17 - /* 17 + /* 18 18 * Format of packets returned from the kernel driver: 19 19 * 20 20 * quadlet with timestamp (microseconds)
+151 -167
drivers/firewire/nosy.c
··· 1 - /* -*- c-file-style: "linux" -*- 2 - * 3 - * nosy.c - Snoop mode driver for TI pcilynx 1394 controllers 4 - * Copyright (C) 2002 Kristian H�gsberg 1 + /* 2 + * nosy - Snoop mode driver for TI PCILynx 1394 controllers 3 + * Copyright (C) 2002-2007 Kristian Høgsberg 5 4 * 6 5 * This program is free software; you can redistribute it and/or modify 7 6 * it under the terms of the GNU General Public License as published by ··· 17 18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19 */ 19 20 20 - #include <linux/kernel.h> 21 - #include <linux/slab.h> 22 - #include <linux/interrupt.h> 23 - #include <linux/sched.h> /* required for linux/wait.h */ 24 - #include <linux/wait.h> 25 21 #include <linux/errno.h> 26 - #include <linux/module.h> 27 - #include <linux/init.h> 28 - #include <linux/pci.h> 29 22 #include <linux/fs.h> 30 - #include <linux/poll.h> 23 + #include <linux/init.h> 24 + #include <linux/interrupt.h> 25 + #include <linux/io.h> 26 + #include <linux/kernel.h> 31 27 #include <linux/miscdevice.h> 32 - #include <asm/byteorder.h> 28 + #include <linux/module.h> 29 + #include <linux/pci.h> 30 + #include <linux/poll.h> 31 + #include <linux/sched.h> /* required for linux/wait.h */ 32 + #include <linux/slab.h> 33 + #include <linux/spinlock.h> 34 + #include <linux/timex.h> 35 + #include <linux/uaccess.h> 36 + #include <linux/wait.h> 37 + 33 38 #include <asm/atomic.h> 34 - #include <asm/io.h> 35 - #include <asm/uaccess.h> 36 - #include <asm/timex.h> 39 + #include <asm/byteorder.h> 37 40 38 41 #include "nosy.h" 39 42 #include "nosy-user.h" ··· 47 46 #define error(s, args...) printk(KERN_ERR s, ## args) 48 47 #define debug(s, args...) printk(KERN_DEBUG s, ## args) 49 48 50 - static const char driver_name[] = "nosy"; 49 + static char driver_name[] = KBUILD_MODNAME; 51 50 52 51 struct pcl_status { 53 52 unsigned int transfer_count : 13; ··· 78 77 } __attribute__ ((packed)); 79 78 80 79 struct packet { 81 - unsigned int length : 16; 82 - unsigned int code : 16; 80 + unsigned int length; 83 81 char data[0]; 84 82 }; 85 83 ··· 87 87 size_t capacity; 88 88 long total_packet_count, lost_packet_count; 89 89 atomic_t size; 90 - struct packet *head, *tail; 91 - wait_queue_head_t wait; 90 + struct packet *head, *tail; 91 + wait_queue_head_t wait; 92 92 }; 93 93 94 94 struct pcilynx { ··· 106 106 struct miscdevice misc; 107 107 }; 108 108 109 - 110 109 struct client { 111 110 struct pcilynx *lynx; 112 111 unsigned long tcode_mask; ··· 114 115 }; 115 116 116 117 #define MAX_MINORS 64 117 - struct pcilynx *minors[MAX_MINORS]; 118 + static struct pcilynx *minors[MAX_MINORS]; 118 119 119 120 static int 120 121 packet_buffer_init(struct packet_buffer *buffer, size_t capacity) ··· 127 128 buffer->capacity = capacity; 128 129 buffer->lost_packet_count = 0; 129 130 atomic_set(&buffer->size, 0); 130 - init_waitqueue_head(&buffer->wait); 131 + init_waitqueue_head(&buffer->wait); 131 132 132 133 return 0; 133 134 } ··· 157 158 if (copy_to_user(data, buffer->head->data, length)) 158 159 return -EFAULT; 159 160 buffer->head = (struct packet *) &buffer->head->data[length]; 160 - } 161 - else { 161 + } else { 162 162 size_t split = end - buffer->head->data; 163 163 164 164 if (copy_to_user(data, buffer->head->data, split)) ··· 167 169 buffer->head = (struct packet *) &buffer->data[length - split]; 168 170 } 169 171 170 - /* Decrease buffer->size as the last thing, since this is what 172 + /* 173 + * Decrease buffer->size as the last thing, since this is what 171 174 * keeps the interrupt from overwriting the packet we are 172 - * retrieving from the buffer. */ 173 - 174 - atomic_sub(sizeof (struct packet) + length, &buffer->size); 175 + * retrieving from the buffer. 176 + */ 177 + atomic_sub(sizeof(struct packet) + length, &buffer->size); 175 178 176 179 return length; 177 180 } ··· 184 185 185 186 buffer->total_packet_count++; 186 187 187 - if (buffer->capacity < 188 - atomic_read(&buffer->size) + sizeof (struct packet) + length) { 188 + if (buffer->capacity < 189 + atomic_read(&buffer->size) + sizeof(struct packet) + length) { 189 190 buffer->lost_packet_count++; 190 191 return; 191 192 } ··· 196 197 if (&buffer->tail->data[length] < end) { 197 198 memcpy(buffer->tail->data, data, length); 198 199 buffer->tail = (struct packet *) &buffer->tail->data[length]; 199 - } 200 - else { 200 + } else { 201 201 size_t split = end - buffer->tail->data; 202 202 203 203 memcpy(buffer->tail->data, data, split); 204 204 memcpy(buffer->data, data + split, length - split); 205 205 buffer->tail = (struct packet *) &buffer->data[length - split]; 206 206 } 207 - 207 + 208 208 /* Finally, adjust buffer size and wake up userspace reader. */ 209 209 210 - atomic_add(sizeof (struct packet) + length, &buffer->size); 210 + atomic_add(sizeof(struct packet) + length, &buffer->size); 211 211 wake_up_interruptible(&buffer->wait); 212 212 } 213 213 214 214 static inline void 215 215 reg_write(struct pcilynx *lynx, int offset, u32 data) 216 216 { 217 - writel(data, lynx->registers + offset); 217 + writel(data, lynx->registers + offset); 218 218 } 219 219 220 220 static inline u32 221 221 reg_read(struct pcilynx *lynx, int offset) 222 222 { 223 - return readl(lynx->registers + offset); 223 + return readl(lynx->registers + offset); 224 224 } 225 225 226 226 static inline void 227 227 reg_set_bits(struct pcilynx *lynx, int offset, u32 mask) 228 228 { 229 - reg_write(lynx, offset, (reg_read(lynx, offset) | mask)); 229 + reg_write(lynx, offset, (reg_read(lynx, offset) | mask)); 230 230 } 231 231 232 - /* Maybe the pcl programs could be setup to just append data instead 233 - * of using a whole packet. */ 234 - 235 - static inline void 236 - run_pcl(struct pcilynx *lynx, dma_addr_t pcl_bus, int dmachan) 232 + /* 233 + * Maybe the pcl programs could be set up to just append data instead 234 + * of using a whole packet. 235 + */ 236 + static inline void 237 + run_pcl(struct pcilynx *lynx, dma_addr_t pcl_bus, 238 + int dmachan) 237 239 { 238 - reg_write(lynx, DMA0_CURRENT_PCL + dmachan * 0x20, pcl_bus); 239 - reg_write(lynx, DMA0_CHAN_CTRL + dmachan * 0x20, 240 - DMA_CHAN_CTRL_ENABLE | DMA_CHAN_CTRL_LINK); 240 + reg_write(lynx, DMA0_CURRENT_PCL + dmachan * 0x20, pcl_bus); 241 + reg_write(lynx, DMA0_CHAN_CTRL + dmachan * 0x20, 242 + DMA_CHAN_CTRL_ENABLE | DMA_CHAN_CTRL_LINK); 241 243 } 242 244 243 245 static int 244 246 set_phy_reg(struct pcilynx *lynx, int addr, int val) 245 247 { 246 - if (addr > 15) { 247 - debug("%s: PHY register address %d out of range", 248 - __FUNCTION__, addr); 249 - return -1; 250 - } 248 + if (addr > 15) { 249 + debug("PHY register address %d out of range\n", addr); 250 + return -1; 251 + } 251 252 252 - if (val > 0xff) { 253 - debug("%s: PHY register value %d out of range", 254 - __FUNCTION__, val); 255 - return -1; 256 - } 253 + if (val > 0xff) { 254 + debug("PHY register value %d out of range\n", val); 255 + return -1; 256 + } 257 257 258 - reg_write(lynx, LINK_PHY, LINK_PHY_WRITE | 258 + reg_write(lynx, LINK_PHY, LINK_PHY_WRITE | 259 259 LINK_PHY_ADDR(addr) | LINK_PHY_WDATA(val)); 260 260 261 - return 0; 261 + return 0; 262 262 } 263 263 264 264 static void ··· 315 317 if (minor > MAX_MINORS || minors[minor] == NULL) 316 318 return -ENODEV; 317 319 318 - file->private_data = nosy_add_client(minors[minor]); 320 + file->private_data = nosy_add_client(minors[minor]); 319 321 if (file->private_data == NULL) 320 322 return -ENOMEM; 321 323 else ··· 327 329 { 328 330 nosy_remove_client(file->private_data); 329 331 330 - return 0; 332 + return 0; 331 333 } 332 334 333 335 static unsigned int ··· 356 358 unsigned int cmd, unsigned long arg) 357 359 { 358 360 struct client *client = file->private_data; 361 + struct nosy_stats stats; 359 362 360 363 switch (cmd) { 361 - case NOSY_IOC_GET_STATS: { 362 - struct nosy_stats stats; 363 - 364 + case NOSY_IOC_GET_STATS: 364 365 stats.total_packet_count = client->buffer.total_packet_count; 365 366 stats.lost_packet_count = client->buffer.lost_packet_count; 366 367 if (copy_to_user((void *) arg, &stats, sizeof stats)) 367 368 return -EFAULT; 368 369 else 369 370 return 0; 370 - } 371 - 371 + 372 372 case NOSY_IOC_START: 373 373 nosy_start_snoop(client); 374 374 return 0; ··· 385 389 } 386 390 } 387 391 388 - static struct file_operations nosy_ops = { 392 + static const struct file_operations nosy_ops = { 389 393 .owner = THIS_MODULE, 390 - .read = nosy_read, 394 + .read = nosy_read, 391 395 .ioctl = nosy_ioctl, 392 - .poll = nosy_poll, 393 - .open = nosy_open, 394 - .release = nosy_release, 396 + .poll = nosy_poll, 397 + .open = nosy_open, 398 + .release = nosy_release, 395 399 }; 396 400 397 401 #define PHY_PACKET_SIZE 12 /* 1 payload, 1 inverse, 1 ack = 3 quadlets */ ··· 408 412 packet_handler(struct pcilynx *lynx) 409 413 { 410 414 unsigned long flags; 411 - struct list_head *pos; 412 415 struct client *client; 413 416 unsigned long tcode_mask; 414 417 size_t length; ··· 429 434 430 435 spin_lock_irqsave(&lynx->client_list_lock, flags); 431 436 432 - list_for_each(pos, &lynx->client_list) { 433 - client = list_entry(pos, struct client, link); 437 + list_for_each_entry(client, &lynx->client_list, link) 434 438 if (client->tcode_mask & tcode_mask) 435 - packet_buffer_put(&client->buffer, 439 + packet_buffer_put(&client->buffer, 436 440 lynx->rcv_buffer, length + 4); 437 - } 438 441 439 442 spin_unlock_irqrestore(&lynx->client_list_lock, flags); 440 443 } ··· 441 448 bus_reset_handler(struct pcilynx *lynx) 442 449 { 443 450 unsigned long flags; 444 - struct list_head *pos; 445 451 struct client *client; 446 452 struct timeval tv; 447 453 ··· 448 456 449 457 spin_lock_irqsave(&lynx->client_list_lock, flags); 450 458 451 - list_for_each(pos, &lynx->client_list) { 452 - client = list_entry(pos, struct client, link); 459 + list_for_each_entry(client, &lynx->client_list, link) 453 460 packet_buffer_put(&client->buffer, &tv.tv_usec, 4); 454 - } 455 461 456 462 spin_unlock_irqrestore(&lynx->client_list_lock, flags); 457 463 } 458 464 459 - 460 - 461 465 static irqreturn_t 462 466 irq_handler(int irq, void *device) 463 467 { 464 - struct pcilynx *lynx = (struct pcilynx *) device; 468 + struct pcilynx *lynx = device; 465 469 u32 pci_int_status; 466 - 467 - pci_int_status = reg_read(lynx, PCI_INT_STATUS); 470 + 471 + pci_int_status = reg_read(lynx, PCI_INT_STATUS); 468 472 469 473 if ((pci_int_status & PCI_INT_INT_PEND) == 0) 470 474 /* Not our interrupt, bail out quickly. */ ··· 493 505 static void 494 506 remove_card(struct pci_dev *dev) 495 507 { 496 - struct pcilynx *lynx; 508 + struct pcilynx *lynx; 497 509 498 - lynx = pci_get_drvdata(dev); 499 - if (!lynx) 510 + lynx = pci_get_drvdata(dev); 511 + if (!lynx) 500 512 return; 501 - pci_set_drvdata(dev, NULL); 513 + pci_set_drvdata(dev, NULL); 502 514 503 515 reg_write(lynx, PCI_INT_ENABLE, 0); 504 516 free_irq(lynx->pci_device->irq, lynx); 505 517 506 - pci_free_consistent(lynx->pci_device, sizeof (struct pcl), 518 + pci_free_consistent(lynx->pci_device, sizeof(struct pcl), 507 519 lynx->rcv_start_pcl, lynx->rcv_start_pcl_bus); 508 - pci_free_consistent(lynx->pci_device, sizeof (struct pcl), 520 + pci_free_consistent(lynx->pci_device, sizeof(struct pcl), 509 521 lynx->rcv_pcl, lynx->rcv_pcl_bus); 510 522 pci_free_consistent(lynx->pci_device, PAGE_SIZE, 511 523 lynx->rcv_buffer, lynx->rcv_buffer_bus); ··· 520 532 521 533 #define RCV_BUFFER_SIZE (16 * 1024) 522 534 523 - #define FAIL(s, args...) \ 524 - do { \ 525 - error(s, ## args); \ 526 - return err; \ 527 - } while (0) 528 - 529 535 static int __devinit 530 536 add_card(struct pci_dev *dev, const struct pci_device_id *unused) 531 537 { 532 - struct pcilynx *lynx; 538 + struct pcilynx *lynx; 533 539 u32 p, end; 534 - int err, i; 540 + int i; 535 541 536 - err = -ENXIO; 537 - 538 - if (pci_set_dma_mask(dev, 0xffffffff)) 539 - FAIL("DMA address limits not supported " 540 - "for PCILynx hardware.\n"); 541 - if (pci_enable_device(dev)) 542 - FAIL("Failed to enable PCILynx hardware.\n"); 543 - pci_set_master(dev); 544 - 545 - err = -ENOMEM; 542 + if (pci_set_dma_mask(dev, 0xffffffff)) { 543 + error("DMA address limits not supported " 544 + "for PCILynx hardware\n"); 545 + return -ENXIO; 546 + } 547 + if (pci_enable_device(dev)) { 548 + error("Failed to enable PCILynx hardware\n"); 549 + return -ENXIO; 550 + } 551 + pci_set_master(dev); 546 552 547 553 lynx = kzalloc(sizeof *lynx, GFP_KERNEL); 548 - if (lynx == NULL) 549 - FAIL("Failed to allocate control structure memory.\n"); 550 - 551 - lynx->pci_device = dev; 552 - pci_set_drvdata(dev, lynx); 554 + if (lynx == NULL) { 555 + error("Failed to allocate control structure memory\n"); 556 + return -ENOMEM; 557 + } 558 + lynx->pci_device = dev; 559 + pci_set_drvdata(dev, lynx); 553 560 554 561 spin_lock_init(&lynx->client_list_lock); 555 562 INIT_LIST_HEAD(&lynx->client_list); 556 563 557 - lynx->registers = ioremap_nocache(pci_resource_start(dev, 0), 558 - PCILYNX_MAX_REGISTER); 564 + lynx->registers = ioremap_nocache(pci_resource_start(dev, 0), 565 + PCILYNX_MAX_REGISTER); 559 566 560 - lynx->rcv_start_pcl = pci_alloc_consistent(lynx->pci_device, 561 - sizeof(struct pcl), 562 - &lynx->rcv_start_pcl_bus); 563 - lynx->rcv_pcl = pci_alloc_consistent(lynx->pci_device, 564 - sizeof(struct pcl), 565 - &lynx->rcv_pcl_bus); 566 - lynx->rcv_buffer = pci_alloc_consistent(lynx->pci_device, RCV_BUFFER_SIZE, 567 - &lynx->rcv_buffer_bus); 568 - if (lynx->rcv_start_pcl == NULL || 567 + lynx->rcv_start_pcl = pci_alloc_consistent(lynx->pci_device, 568 + sizeof(struct pcl), &lynx->rcv_start_pcl_bus); 569 + lynx->rcv_pcl = pci_alloc_consistent(lynx->pci_device, 570 + sizeof(struct pcl), &lynx->rcv_pcl_bus); 571 + lynx->rcv_buffer = pci_alloc_consistent(lynx->pci_device, 572 + RCV_BUFFER_SIZE, &lynx->rcv_buffer_bus); 573 + if (lynx->rcv_start_pcl == NULL || 569 574 lynx->rcv_pcl == NULL || 570 - lynx->rcv_buffer == NULL) 575 + lynx->rcv_buffer == NULL) { 571 576 /* FIXME: do proper error handling. */ 572 - FAIL("Failed to allocate receive buffer.\n"); 573 - 577 + error("Failed to allocate receive buffer\n"); 578 + return -ENOMEM; 579 + } 574 580 lynx->rcv_start_pcl->next = lynx->rcv_pcl_bus; 575 - lynx->rcv_pcl->next = PCL_NEXT_INVALID; 576 - lynx->rcv_pcl->async_error_next = PCL_NEXT_INVALID; 581 + lynx->rcv_pcl->next = PCL_NEXT_INVALID; 582 + lynx->rcv_pcl->async_error_next = PCL_NEXT_INVALID; 577 583 578 - lynx->rcv_pcl->buffer[0].control = 584 + lynx->rcv_pcl->buffer[0].control = 579 585 PCL_CMD_RCV | PCL_BIGENDIAN | 2044; 580 - lynx->rcv_pcl->buffer[0].pointer = lynx->rcv_buffer_bus + 4; 586 + lynx->rcv_pcl->buffer[0].pointer = lynx->rcv_buffer_bus + 4; 581 587 p = lynx->rcv_buffer_bus + 2048; 582 588 end = lynx->rcv_buffer_bus + RCV_BUFFER_SIZE; 583 589 for (i = 1; p < end; i++, p += 2048) { ··· 581 599 } 582 600 lynx->rcv_pcl->buffer[i - 1].control |= PCL_LAST_BUFF; 583 601 584 - reg_set_bits(lynx, MISC_CONTROL, MISC_CONTROL_SWRESET); 585 - /* Fix buggy cards with autoboot pin not tied low: */ 586 - reg_write(lynx, DMA0_CHAN_CTRL, 0); 587 - reg_write(lynx, DMA_GLOBAL_REGISTER, 0x00 << 24); 602 + reg_set_bits(lynx, MISC_CONTROL, MISC_CONTROL_SWRESET); 603 + /* Fix buggy cards with autoboot pin not tied low: */ 604 + reg_write(lynx, DMA0_CHAN_CTRL, 0); 605 + reg_write(lynx, DMA_GLOBAL_REGISTER, 0x00 << 24); 588 606 589 607 #if 0 590 - /* now, looking for PHY register set */ 591 - if ((get_phy_reg(lynx, 2) & 0xe0) == 0xe0) { 592 - lynx->phyic.reg_1394a = 1; 593 - PRINT(KERN_INFO, lynx->id, 594 - "found 1394a conform PHY (using extended register set)"); 595 - lynx->phyic.vendor = get_phy_vendorid(lynx); 596 - lynx->phyic.product = get_phy_productid(lynx); 597 - } else { 598 - lynx->phyic.reg_1394a = 0; 599 - PRINT(KERN_INFO, lynx->id, "found old 1394 PHY"); 600 - } 608 + /* now, looking for PHY register set */ 609 + if ((get_phy_reg(lynx, 2) & 0xe0) == 0xe0) { 610 + lynx->phyic.reg_1394a = 1; 611 + PRINT(KERN_INFO, lynx->id, 612 + "found 1394a conform PHY (using extended register set)"); 613 + lynx->phyic.vendor = get_phy_vendorid(lynx); 614 + lynx->phyic.product = get_phy_productid(lynx); 615 + } else { 616 + lynx->phyic.reg_1394a = 0; 617 + PRINT(KERN_INFO, lynx->id, "found old 1394 PHY"); 618 + } 601 619 #endif 602 620 603 621 /* Setup the general receive FIFO max size. */ 604 622 reg_write(lynx, FIFO_SIZES, 255); 605 623 606 - reg_set_bits(lynx, PCI_INT_ENABLE, PCI_INT_DMA_ALL); 624 + reg_set_bits(lynx, PCI_INT_ENABLE, PCI_INT_DMA_ALL); 607 625 608 - reg_write(lynx, LINK_INT_ENABLE, 626 + reg_write(lynx, LINK_INT_ENABLE, 609 627 LINK_INT_PHY_TIME_OUT | LINK_INT_PHY_REG_RCVD | 610 628 LINK_INT_PHY_BUSRESET | LINK_INT_IT_STUCK | 611 629 LINK_INT_AT_STUCK | LINK_INT_SNTRJ | ··· 620 638 621 639 run_pcl(lynx, lynx->rcv_start_pcl_bus, 0); 622 640 623 - if (request_irq(dev->irq, irq_handler, IRQF_SHARED, driver_name, lynx)) 624 - FAIL("Failed to allocate shared interrupt %d.", dev->irq); 641 + if (request_irq(dev->irq, irq_handler, IRQF_SHARED, 642 + driver_name, lynx)) { 643 + error("Failed to allocate shared interrupt %d\n", dev->irq); 644 + return -EIO; 645 + } 625 646 626 647 lynx->misc.parent = &dev->dev; 627 648 lynx->misc.minor = MISC_DYNAMIC_MINOR; 628 649 lynx->misc.name = "nosy"; 629 650 lynx->misc.fops = &nosy_ops; 630 - if (misc_register(&lynx->misc)) 631 - FAIL("Failed to register misc char device."); 651 + if (misc_register(&lynx->misc)) { 652 + error("Failed to register misc char device\n"); 653 + return -ENOMEM; 654 + } 632 655 minors[lynx->misc.minor] = lynx; 633 656 634 657 notify("Initialized PCILynx IEEE1394 card, irq=%d\n", dev->irq); 635 658 636 - return 0; 659 + return 0; 637 660 } 638 661 639 662 static struct pci_device_id pci_table[] __devinitdata = { 640 663 { 641 - .vendor = PCI_VENDOR_ID_TI, 642 - .device = PCI_DEVICE_ID_TI_PCILYNX, 643 - .subvendor = PCI_ANY_ID, 644 - .subdevice = PCI_ANY_ID, 664 + .vendor = PCI_VENDOR_ID_TI, 665 + .device = PCI_DEVICE_ID_TI_PCILYNX, 666 + .subvendor = PCI_ANY_ID, 667 + .subdevice = PCI_ANY_ID, 645 668 }, 646 669 { } /* Terminating entry */ 647 670 }; 648 671 649 672 static struct pci_driver lynx_pci_driver = { 650 - .name = (char *) driver_name, 673 + .name = driver_name, 651 674 .id_table = pci_table, 652 675 .probe = add_card, 653 - .remove = __devexit_p(remove_card), 676 + .remove = remove_card, 654 677 }; 655 678 656 - MODULE_AUTHOR("Kristian H�gsberg"); 679 + MODULE_AUTHOR("Kristian Hoegsberg"); 657 680 MODULE_DESCRIPTION("Snoop mode driver for TI pcilynx 1394 controllers"); 658 681 MODULE_LICENSE("GPL"); 659 682 MODULE_DEVICE_TABLE(pci, pci_table); 660 683 661 684 static int __init nosy_init(void) 662 685 { 663 - /* notify("Loaded %s version %s.\n", driver_name, VERSION); */ 664 - 665 - return pci_register_driver(&lynx_pci_driver); 686 + return pci_register_driver(&lynx_pci_driver); 666 687 } 667 688 668 689 static void __exit nosy_cleanup(void) 669 690 { 670 - pci_unregister_driver(&lynx_pci_driver); 691 + pci_unregister_driver(&lynx_pci_driver); 671 692 672 693 notify("Unloaded %s.\n", driver_name); 673 694 } 674 - 675 695 676 696 module_init(nosy_init); 677 697 module_exit(nosy_cleanup);
+13 -14
drivers/firewire/nosy.h
··· 1 - /* Chip register definitions for PCILynx chipset. Based on pcilynx.h 1 + /* 2 + * Chip register definitions for PCILynx chipset. Based on pcilynx.h 2 3 * from the Linux 1394 drivers, but modified a bit so the names here 3 4 * match the specification exactly (even though they have weird names, 4 5 * like xxx_OVER_FLOW, or arbitrary abbreviations like SNTRJ for "sent ··· 17 16 #define SERIAL_EEPROM_CONTROL 0x44 18 17 19 18 #define PCI_INT_STATUS 0x48 20 - #define PCI_INT_ENABLE 0x4c 19 + #define PCI_INT_ENABLE 0x4c 21 20 /* status and enable have identical bit numbers */ 22 21 #define PCI_INT_INT_PEND (1<<31) 23 22 #define PCI_INT_FRC_INT (1<<30) ··· 49 48 #define LBUS_ADDR_SEL_RAM (0x0<<16) 50 49 #define LBUS_ADDR_SEL_ROM (0x1<<16) 51 50 #define LBUS_ADDR_SEL_AUX (0x2<<16) 52 - #define LBUS_ADDR_SEL_ZV (0x3<<16) 51 + #define LBUS_ADDR_SEL_ZV (0x3<<16) 53 52 54 53 #define GPIO_CTRL_A 0xb8 55 54 #define GPIO_CTRL_B 0xbc ··· 91 90 #define PCL_BIGENDIAN (1<<16) 92 91 #define PCL_ISOMODE (1<<12) 93 92 94 - #define DMA0_PREV_PCL 0x100 93 + #define DMA0_PREV_PCL 0x100 95 94 #define DMA1_PREV_PCL 0x120 96 95 #define DMA2_PREV_PCL 0x140 97 96 #define DMA3_PREV_PCL 0x160 98 97 #define DMA4_PREV_PCL 0x180 99 98 #define DMA_PREV_PCL(chan) (DMA_BREG(DMA0_PREV_PCL, chan)) 100 99 101 - #define DMA0_CURRENT_PCL 0x104 100 + #define DMA0_CURRENT_PCL 0x104 102 101 #define DMA1_CURRENT_PCL 0x124 103 102 #define DMA2_CURRENT_PCL 0x144 104 103 #define DMA3_CURRENT_PCL 0x164 ··· 119 118 #define DMA_CHAN_STAT_PKTCMPL (1<<27) 120 119 #define DMA_CHAN_STAT_SPECIALACK (1<<14) 121 120 122 - 123 - #define DMA0_CHAN_CTRL 0x110 121 + #define DMA0_CHAN_CTRL 0x110 124 122 #define DMA1_CHAN_CTRL 0x130 125 123 #define DMA2_CHAN_CTRL 0x150 126 124 #define DMA3_CHAN_CTRL 0x170 127 125 #define DMA4_CHAN_CTRL 0x190 128 126 #define DMA_CHAN_CTRL(chan) (DMA_BREG(DMA0_CHAN_CTRL, chan)) 129 127 /* CHAN_CTRL registers share bits */ 130 - #define DMA_CHAN_CTRL_ENABLE (1<<31) 128 + #define DMA_CHAN_CTRL_ENABLE (1<<31) 131 129 #define DMA_CHAN_CTRL_BUSY (1<<30) 132 130 #define DMA_CHAN_CTRL_LINK (1<<29) 133 131 ··· 153 153 #define DMA2_WORD0_CMP_VALUE 0xb20 154 154 #define DMA3_WORD0_CMP_VALUE 0xb30 155 155 #define DMA4_WORD0_CMP_VALUE 0xb40 156 - #define DMA_WORD0_CMP_VALUE(chan) (DMA_SREG(DMA0_WORD0_CMP_VALUE, chan)) 156 + #define DMA_WORD0_CMP_VALUE(chan) (DMA_SREG(DMA0_WORD0_CMP_VALUE, chan)) 157 157 158 158 #define DMA0_WORD0_CMP_ENABLE 0xb04 159 159 #define DMA1_WORD0_CMP_ENABLE 0xb14 160 160 #define DMA2_WORD0_CMP_ENABLE 0xb24 161 161 #define DMA3_WORD0_CMP_ENABLE 0xb34 162 162 #define DMA4_WORD0_CMP_ENABLE 0xb44 163 - #define DMA_WORD0_CMP_ENABLE(chan) (DMA_SREG(DMA0_WORD0_CMP_ENABLE,chan)) 163 + #define DMA_WORD0_CMP_ENABLE(chan) (DMA_SREG(DMA0_WORD0_CMP_ENABLE, chan)) 164 164 165 165 #define DMA0_WORD1_CMP_VALUE 0xb08 166 166 #define DMA1_WORD1_CMP_VALUE 0xb18 167 167 #define DMA2_WORD1_CMP_VALUE 0xb28 168 168 #define DMA3_WORD1_CMP_VALUE 0xb38 169 169 #define DMA4_WORD1_CMP_VALUE 0xb48 170 - #define DMA_WORD1_CMP_VALUE(chan) (DMA_SREG(DMA0_WORD1_CMP_VALUE, chan)) 170 + #define DMA_WORD1_CMP_VALUE(chan) (DMA_SREG(DMA0_WORD1_CMP_VALUE, chan)) 171 171 172 172 #define DMA0_WORD1_CMP_ENABLE 0xb0c 173 173 #define DMA1_WORD1_CMP_ENABLE 0xb1c 174 174 #define DMA2_WORD1_CMP_ENABLE 0xb2c 175 175 #define DMA3_WORD1_CMP_ENABLE 0xb3c 176 176 #define DMA4_WORD1_CMP_ENABLE 0xb4c 177 - #define DMA_WORD1_CMP_ENABLE(chan) (DMA_SREG(DMA0_WORD1_CMP_ENABLE,chan)) 177 + #define DMA_WORD1_CMP_ENABLE(chan) (DMA_SREG(DMA0_WORD1_CMP_ENABLE, chan)) 178 178 /* word 1 compare enable flags */ 179 179 #define DMA_WORD1_CMP_MATCH_OTHERBUS (1<<15) 180 180 #define DMA_WORD1_CMP_MATCH_BROADCAST (1<<14) ··· 211 211 #define LINK_PHY_WDATA(data) (data<<16) 212 212 #define LINK_PHY_RADDR(addr) (addr<<8) 213 213 214 - 215 214 #define LINK_INT_STATUS 0xf14 216 215 #define LINK_INT_ENABLE 0xf18 217 216 /* status and enable have identical bit numbers */ ··· 234 235 #define LINK_INT_GRF_OVER_FLOW (1<<5) 235 236 #define LINK_INT_ITF_UNDER_FLOW (1<<4) 236 237 #define LINK_INT_ATF_UNDER_FLOW (1<<3) 237 - #define LINK_INT_IARB_FAILED (1<<0) 238 + #define LINK_INT_IARB_FAILED (1<<0)