summaryrefslogtreecommitdiffstats
path: root/mm/swapfile.c
diff options
context:
space:
mode:
authorIan Abbott2013-04-04 15:59:04 +0200
committerGreg Kroah-Hartman2013-04-05 23:33:19 +0200
commit5b7dba1bdda5b5864b61d28e32f860510e9a660f (patch)
tree22fd025cf46132d9baa5d083f3fd3ac9e7fed3c8 /mm/swapfile.c
parentstaging: comedi: remove COMEDI_FIRST_SUBDEVICE_MINOR (diff)
downloadkernel-qcow2-linux-5b7dba1bdda5b5864b61d28e32f860510e9a660f.tar.gz
kernel-qcow2-linux-5b7dba1bdda5b5864b61d28e32f860510e9a660f.tar.xz
kernel-qcow2-linux-5b7dba1bdda5b5864b61d28e32f860510e9a660f.zip
staging: comedi: separate board and subdevice minor tables
The comedi core reserves minor device numbers from 0 to `COMEDI_NUM_BOARD_MINORS - 1` (0 to 0x30 - 1) for the main comedi "board" devices and reserves minor device numbers from `COMEDI_NUM_BOARD_MINORS` to `COMEDI_NUM_MINORS - 1` (0x30 to 0x100 - 1) for comedi subdevices (or at least those that claim to support asynchronous comedi commands). There is an array `comedi_file_info_table[COMEDI_NUM_MINORS]` used to hold pointers to information for each board minor device number and subdevice minor device number that has been allocated (with NULL pointers for those not allocated), along with a protective lock `comedi_file_info_table_lock`. Since the ranges of board minor device numbers and subdevice minor device numbers do not overlap, we can use separate tables and separate locks for the different types of minor device numbers. This will allow us to use different pointer types for the elements of each table in the future without just using a generic `void *`. (At the moment, the table elements point to a `struct comedi_file_info` allocated dynamically for each allocated board minor device or subdevice minor device, but I plan to get rid of that data structure.) Replace `comedi_file_info_table[COMEDI_NUM_MINORS]` with two new arrays of the same type, `comedi_board_minor_table[COMEDI_NUM_BOARD_MINORS]` for board minors, and `comedi_subdevice_minor_table[COMEDI_NUM_SUBDEVICE_MINORS]` for subdevice minors (where `COMEDI_NUM_SUBDEVICE_MINORS` is `COMEDI_NUM_MINORS - COMEDI_NUM_BOARD_MINORS`). `comedi_subdevice_minor_table[]` is indexed by the subdevice minor number minus `COMEDI_NUM_BOARD_MINORS` since `COMEDI_NUM_BOARD_MINORS` is the first valid subdevice minor number. Replace `comedi_file_info_table_lock` with `comedi_board_minor_table_lock` for board minors and `comedi_subdevice_minor_table_lock` for subdevice minors. Refactor `comedi_clear_minor()` to call one of two new functions `comedi_clear_board_minor()` and `comedi_clear_subdevice_minor()` depending on the minor device number passed as a parameter. Similarly, refactor `comedi_file_info_from_minor()` to call one of two new functions `comedi_file_info_from_board_minor()` and `comedi_file_info_from_subdevice_minor()` depending on the minor device number parameter. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm/swapfile.c')
0 files changed, 0 insertions, 0 deletions