drivers/gpib/cb7210/cb7210.c

Source file repositories/reference/linux-study-clean/drivers/gpib/cb7210/cb7210.c

File Facts

System
Linux kernel
Corpus path
drivers/gpib/cb7210/cb7210.c
Extension
.c
Size
47551 bytes
Lines
1588
Domain
Driver Families
Bucket
drivers/gpib
Inferred role
Driver Families: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

static struct pci_driver cb7210_pci_driver = {
	.name = DRV_NAME,
	.id_table = cb7210_pci_table,
	.probe = &cb7210_pci_probe
};

/***************************************************************************
 *  Support for computer boards pcmcia-gpib card
 *
 *  Based on gpib PCMCIA client driver written by Claus Schroeter
 *  (clausi@chemie.fu-berlin.de), which was adapted from the
 *  pcmcia skeleton example (presumably David Hinds)
 ***************************************************************************/

#ifdef CONFIG_GPIB_PCMCIA

#include <linux/kernel.h>
#include <linux/ptrace.h>
#include <linux/timer.h>
#include <linux/io.h>

#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>

/*
 * The event() function is this driver's Card Services event handler.
 * It will be called by Card Services when an appropriate card status
 * event is received.  The config() and release() entry points are
 * used to configure or release a socket, in response to card insertion
 * and ejection events.	 They are invoked from the gpib event
 * handler.
 */

static int cb_gpib_config(struct pcmcia_device	*link);
static void cb_gpib_release(struct pcmcia_device  *link);
static int cb_pcmcia_attach(struct gpib_board *board, const struct gpib_board_config *config);
static void cb_pcmcia_detach(struct gpib_board *board);

/*
 *  A linked list of "instances" of the gpib device.  Each actual
 *  PCMCIA card corresponds to one device instance, and is described
 *  by one dev_link_t structure (defined in ds.h).
 *
 *  You may not want to use a linked list for this -- for example, the
 *  memory card driver uses an array of dev_link_t pointers, where minor
 *  device numbers are used to derive the corresponding array index.
 */

static	struct pcmcia_device  *curr_dev;

/*
 *  A dev_link_t structure has fields for most things that are needed
 *  to keep track of a socket, but there will usually be some device
 *  specific information that also needs to be kept track of.  The
 *  'priv' pointer in a dev_link_t structure can be used to point to
 *  a device-specific private data structure, like this.
 *
 *  A driver needs to provide a dev_node_t structure for each device
 *  on a card.	In some cases, there is only one device per card (for
 *  example, ethernet cards, modems).  In other cases, there may be
 *  many actual or logical devices (SCSI adapters, memory cards with
 *  multiple partitions).  The dev_node_t structures need to be kept
 *  in a linked list starting at the 'dev' field of a dev_link_t
 *  structure.	We allocate them in the card's private data structure,
 * because they generally can't be allocated dynamically.
 */

struct local_info {
	struct pcmcia_device	*p_dev;
	struct gpib_board		*dev;
};

/*
 *  gpib_attach() creates an "instance" of the driver, allocating
 *  local data structures for one device.  The device is registered
 *  with Card Services.
 *
 *  The dev_link structure is initialized, but we don't actually
 *  configure the card at this point -- we wait until we receive a
 *  card insertion event.
 */

static int cb_gpib_probe(struct pcmcia_device *link)
{
	struct local_info *info;
	int ret;

	/* Allocate space for private device-specific data */
	info = kzalloc_obj(*info);
	if (!info)

Annotation

Implementation Notes