aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/xilinx_hwicap
diff options
context:
space:
mode:
authorStephen Neuendorffer <stephen.neuendorffer@xilinx.com>2008-03-17 13:36:32 -0400
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>2008-03-26 08:27:31 -0400
commitac646734490b83afad3e058edeb6600d3666553b (patch)
tree294302f6b8330eaa402ea4d7afde073c36e8d8fe /drivers/char/xilinx_hwicap
parent4c58f8fe2e84ba76a4bef01cbd987b5ce62771c3 (diff)
[POWERPC] Xilinx: hwicap: Use fixed device major.
Major 259 has been assigned by lanana. Use it. Also, publish /dev/icap[0-k] as the device entries, and register platform devices named 'icap' to be consistent. Signed-off-by: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char/xilinx_hwicap')
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c43
1 files changed, 14 insertions, 29 deletions
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 5b8d6463e11e..016f90567a52 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -36,7 +36,7 @@
36 *****************************************************************************/ 36 *****************************************************************************/
37 37
38/* 38/*
39 * This is the code behind /dev/xilinx_icap -- it allows a user-space 39 * This is the code behind /dev/icap* -- it allows a user-space
40 * application to use the Xilinx ICAP subsystem. 40 * application to use the Xilinx ICAP subsystem.
41 * 41 *
42 * The following operations are possible: 42 * The following operations are possible:
@@ -67,7 +67,7 @@
67 * user-space application code that uses this device. The simplest 67 * user-space application code that uses this device. The simplest
68 * way to use this interface is simply: 68 * way to use this interface is simply:
69 * 69 *
70 * cp foo.bit /dev/xilinx_icap 70 * cp foo.bit /dev/icap0
71 * 71 *
72 * Note that unless foo.bit is an appropriately constructed partial 72 * Note that unless foo.bit is an appropriately constructed partial
73 * bitstream, this has a high likelyhood of overwriting the design 73 * bitstream, this has a high likelyhood of overwriting the design
@@ -105,18 +105,14 @@
105#include "buffer_icap.h" 105#include "buffer_icap.h"
106#include "fifo_icap.h" 106#include "fifo_icap.h"
107 107
108#define DRIVER_NAME "xilinx_icap" 108#define DRIVER_NAME "icap"
109 109
110#define HWICAP_REGS (0x10000) 110#define HWICAP_REGS (0x10000)
111 111
112/* dynamically allocate device number */ 112#define XHWICAP_MAJOR 259
113static int xhwicap_major; 113#define XHWICAP_MINOR 0
114static int xhwicap_minor;
115#define HWICAP_DEVICES 1 114#define HWICAP_DEVICES 1
116 115
117module_param(xhwicap_major, int, S_IRUGO);
118module_param(xhwicap_minor, int, S_IRUGO);
119
120/* An array, which is set to true when the device is registered. */ 116/* An array, which is set to true when the device is registered. */
121static bool probed_devices[HWICAP_DEVICES]; 117static bool probed_devices[HWICAP_DEVICES];
122static struct mutex icap_sem; 118static struct mutex icap_sem;
@@ -605,7 +601,7 @@ static int __devinit hwicap_setup(struct device *dev, int id,
605 probed_devices[id] = 1; 601 probed_devices[id] = 1;
606 mutex_unlock(&icap_sem); 602 mutex_unlock(&icap_sem);
607 603
608 devt = MKDEV(xhwicap_major, xhwicap_minor + id); 604 devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR + id);
609 605
610 drvdata = kzalloc(sizeof(struct hwicap_drvdata), GFP_KERNEL); 606 drvdata = kzalloc(sizeof(struct hwicap_drvdata), GFP_KERNEL);
611 if (!drvdata) { 607 if (!drvdata) {
@@ -710,7 +706,7 @@ static int __devexit hwicap_remove(struct device *dev)
710 dev_set_drvdata(dev, NULL); 706 dev_set_drvdata(dev, NULL);
711 707
712 mutex_lock(&icap_sem); 708 mutex_lock(&icap_sem);
713 probed_devices[MINOR(dev->devt)-xhwicap_minor] = 0; 709 probed_devices[MINOR(dev->devt)-XHWICAP_MINOR] = 0;
714 mutex_unlock(&icap_sem); 710 mutex_unlock(&icap_sem);
715 return 0; /* success */ 711 return 0; /* success */
716} 712}
@@ -850,23 +846,12 @@ static int __init hwicap_module_init(void)
850 icap_class = class_create(THIS_MODULE, "xilinx_config"); 846 icap_class = class_create(THIS_MODULE, "xilinx_config");
851 mutex_init(&icap_sem); 847 mutex_init(&icap_sem);
852 848
853 if (xhwicap_major) { 849 devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
854 devt = MKDEV(xhwicap_major, xhwicap_minor); 850 retval = register_chrdev_region(devt,
855 retval = register_chrdev_region( 851 HWICAP_DEVICES,
856 devt, 852 DRIVER_NAME);
857 HWICAP_DEVICES, 853 if (retval < 0)
858 DRIVER_NAME); 854 return retval;
859 if (retval < 0)
860 return retval;
861 } else {
862 retval = alloc_chrdev_region(&devt,
863 xhwicap_minor,
864 HWICAP_DEVICES,
865 DRIVER_NAME);
866 if (retval < 0)
867 return retval;
868 xhwicap_major = MAJOR(devt);
869 }
870 855
871 retval = platform_driver_register(&hwicap_platform_driver); 856 retval = platform_driver_register(&hwicap_platform_driver);
872 857
@@ -891,7 +876,7 @@ static int __init hwicap_module_init(void)
891 876
892static void __exit hwicap_module_cleanup(void) 877static void __exit hwicap_module_cleanup(void)
893{ 878{
894 dev_t devt = MKDEV(xhwicap_major, xhwicap_minor); 879 dev_t devt = MKDEV(XHWICAP_MAJOR, XHWICAP_MINOR);
895 880
896 class_destroy(icap_class); 881 class_destroy(icap_class);
897 882