Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 91471
b: refs/heads/master
c: ac64673
h: refs/heads/master
i:
  91469: 2ac95e7
  91467: 457a7f8
  91463: c131027
  91455: 726bb4d
v: v3
  • Loading branch information
Stephen Neuendorffer authored and Josh Boyer committed Mar 26, 2008
1 parent 9c19177 commit b787a61
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4c58f8fe2e84ba76a4bef01cbd987b5ce62771c3
refs/heads/master: ac646734490b83afad3e058edeb6600d3666553b
43 changes: 14 additions & 29 deletions trunk/drivers/char/xilinx_hwicap/xilinx_hwicap.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
*****************************************************************************/

/*
* This is the code behind /dev/xilinx_icap -- it allows a user-space
* This is the code behind /dev/icap* -- it allows a user-space
* application to use the Xilinx ICAP subsystem.
*
* The following operations are possible:
Expand Down Expand Up @@ -67,7 +67,7 @@
* user-space application code that uses this device. The simplest
* way to use this interface is simply:
*
* cp foo.bit /dev/xilinx_icap
* cp foo.bit /dev/icap0
*
* Note that unless foo.bit is an appropriately constructed partial
* bitstream, this has a high likelyhood of overwriting the design
Expand Down Expand Up @@ -105,18 +105,14 @@
#include "buffer_icap.h"
#include "fifo_icap.h"

#define DRIVER_NAME "xilinx_icap"
#define DRIVER_NAME "icap"

#define HWICAP_REGS (0x10000)

/* dynamically allocate device number */
static int xhwicap_major;
static int xhwicap_minor;
#define XHWICAP_MAJOR 259
#define XHWICAP_MINOR 0
#define HWICAP_DEVICES 1

module_param(xhwicap_major, int, S_IRUGO);
module_param(xhwicap_minor, int, S_IRUGO);

/* An array, which is set to true when the device is registered. */
static bool probed_devices[HWICAP_DEVICES];
static struct mutex icap_sem;
Expand Down Expand Up @@ -605,7 +601,7 @@ static int __devinit hwicap_setup(struct device *dev, int id,
probed_devices[id] = 1;
mutex_unlock(&icap_sem);

devt = MKDEV(xhwicap_major, xhwicap_minor + id);
devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR + id);

drvdata = kzalloc(sizeof(struct hwicap_drvdata), GFP_KERNEL);
if (!drvdata) {
Expand Down Expand Up @@ -710,7 +706,7 @@ static int __devexit hwicap_remove(struct device *dev)
dev_set_drvdata(dev, NULL);

mutex_lock(&icap_sem);
probed_devices[MINOR(dev->devt)-xhwicap_minor] = 0;
probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0;
mutex_unlock(&icap_sem);
return 0; /* success */
}
Expand Down Expand Up @@ -850,23 +846,12 @@ static int __init hwicap_module_init(void)
icap_class = class_create(THIS_MODULE, "xilinx_config");
mutex_init(&icap_sem);

if (xhwicap_major) {
devt = MKDEV(xhwicap_major, xhwicap_minor);
retval = register_chrdev_region(
devt,
HWICAP_DEVICES,
DRIVER_NAME);
if (retval < 0)
return retval;
} else {
retval = alloc_chrdev_region(&devt,
xhwicap_minor,
HWICAP_DEVICES,
DRIVER_NAME);
if (retval < 0)
return retval;
xhwicap_major = MAJOR(devt);
}
devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
retval = register_chrdev_region(devt,
HWICAP_DEVICES,
DRIVER_NAME);
if (retval < 0)
return retval;

retval = platform_driver_register(&hwicap_platform_driver);

Expand All @@ -891,7 +876,7 @@ static int __init hwicap_module_init(void)

static void __exit hwicap_module_cleanup(void)
{
dev_t devt = MKDEV(xhwicap_major, xhwicap_minor);
dev_t devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);

class_destroy(icap_class);

Expand Down

0 comments on commit b787a61

Please sign in to comment.