Commit e1d118f1 authored by Stefan Richter's avatar Stefan Richter Committed by Ben Collins
Browse files

[PATCH] ieee1394: coding style and comment fixes in midlayer header files



Adjust tabulators, line wraps, empty lines, and comment style.
Update comments in ieee1394_transactions.h and highlevel.h.
Fix typo in comment in csr.h.

Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: default avatarBen Collins <bcollins@ubuntu.com>
parent 2b01b80b
Loading
Loading
Loading
Loading
+49 −49
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@
/* IEEE 1394 bus specific Configuration ROM Key IDs */
#define IEEE1394_KV_ID_POWER_REQUIREMENTS (0x30)

/* IEEE 1394 Bus Inforamation Block specifics */
/* IEEE 1394 Bus Information Block specifics */
#define CSR_BUS_INFO_SIZE (5 * sizeof(quadlet_t))

#define CSR_IRMC_SHIFT			31
@@ -64,7 +64,7 @@ struct csr_control {
	quadlet_t state;
	quadlet_t node_ids;
	quadlet_t split_timeout_hi, split_timeout_lo;
	unsigned long expire;	// Calculated from split_timeout
	unsigned long expire;	/* Calculated from split_timeout */
	quadlet_t cycle_time;
	quadlet_t bus_time;
	quadlet_t bus_manager_id;
+50 −31
Original line number Diff line number Diff line
@@ -13,66 +13,85 @@
#include <linux/pci.h>
#include <asm/scatterlist.h>

/* struct dma_prog_region

   a small, physically-contiguous DMA buffer with random-access,
   synchronous usage characteristics
/**
 * struct dma_prog_region - small contiguous DMA buffer
 * @kvirt:    kernel virtual address
 * @dev:      PCI device
 * @n_pages:  number of kernel pages
 * @bus_addr: base bus address
 *
 * a small, physically contiguous DMA buffer with random-access, synchronous
 * usage characteristics
 */

struct dma_prog_region {
	unsigned char    *kvirt;     /* kernel virtual address */
	struct pci_dev   *dev;       /* PCI device */
	unsigned int      n_pages;   /* # of kernel pages */
	dma_addr_t        bus_addr;  /* base bus address */
	unsigned char *kvirt;
	struct pci_dev *dev;
	unsigned int n_pages;
	dma_addr_t bus_addr;
};

/* clear out all fields but do not allocate any memory */
void dma_prog_region_init(struct dma_prog_region *prog);
int  dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes, struct pci_dev *dev);
int dma_prog_region_alloc(struct dma_prog_region *prog, unsigned long n_bytes,
			  struct pci_dev *dev);
void dma_prog_region_free(struct dma_prog_region *prog);

static inline dma_addr_t dma_prog_region_offset_to_bus(struct dma_prog_region *prog, unsigned long offset)
static inline dma_addr_t dma_prog_region_offset_to_bus(
		struct dma_prog_region *prog, unsigned long offset)
{
	return prog->bus_addr + offset;
}

/* struct dma_region

   a large, non-physically-contiguous DMA buffer with streaming,
   asynchronous usage characteristics
/**
 * struct dma_region - large non-contiguous DMA buffer
 * @virt:        kernel virtual address
 * @dev:         PCI device
 * @n_pages:     number of kernel pages
 * @n_dma_pages: number of IOMMU pages
 * @sglist:      IOMMU mapping
 * @direction:   PCI_DMA_TODEVICE, etc.
 *
 * a large, non-physically-contiguous DMA buffer with streaming, asynchronous
 * usage characteristics
 */

struct dma_region {
	unsigned char      *kvirt;       /* kernel virtual address */
	struct pci_dev     *dev;         /* PCI device */
	unsigned int        n_pages;     /* # of kernel pages */
	unsigned int        n_dma_pages; /* # of IOMMU pages */
	struct scatterlist *sglist;      /* IOMMU mapping */
	int                 direction;   /* PCI_DMA_TODEVICE, etc */
	unsigned char *kvirt;
	struct pci_dev *dev;
	unsigned int n_pages;
	unsigned int n_dma_pages;
	struct scatterlist *sglist;
	int direction;
};

/* clear out all fields but do not allocate anything */
void dma_region_init(struct dma_region *dma);

/* allocate the buffer and map it to the IOMMU */
int  dma_region_alloc(struct dma_region *dma, unsigned long n_bytes, struct pci_dev *dev, int direction);
int dma_region_alloc(struct dma_region *dma, unsigned long n_bytes,
		     struct pci_dev *dev, int direction);

/* unmap and free the buffer */
void dma_region_free(struct dma_region *dma);

/* sync the CPU's view of the buffer */
void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset, unsigned long len);
void dma_region_sync_for_cpu(struct dma_region *dma, unsigned long offset,
			     unsigned long len);

/* sync the IO bus' view of the buffer */
void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset, unsigned long len);
void dma_region_sync_for_device(struct dma_region *dma, unsigned long offset,
				unsigned long len);

/* map the buffer into a user space process */
int  dma_region_mmap(struct dma_region *dma, struct file *file, struct vm_area_struct *vma);
int  dma_region_mmap(struct dma_region *dma, struct file *file,
		     struct vm_area_struct *vma);

/* macro to index into a DMA region (or dma_prog_region) */
#define dma_region_i(_dma, _type, _index) ( ((_type*) ((_dma)->kvirt)) + (_index) )
#define dma_region_i(_dma, _type, _index) \
	( ((_type*) ((_dma)->kvirt)) + (_index) )

/* return the DMA bus address of the byte with the given offset
   relative to the beginning of the dma_region */
dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset);
 * relative to the beginning of the dma_region */
dma_addr_t dma_region_offset_to_bus(struct dma_region *dma,
				    unsigned long offset);

#endif /* IEEE1394_DMA_H */
+97 −100
Original line number Diff line number Diff line

#ifndef IEEE1394_HIGHLEVEL_H
#define IEEE1394_HIGHLEVEL_H


/* internal to ieee1394 core */
struct hpsb_address_serve {
	struct list_head host_list;	/* per host list */

	struct list_head hl_list;	/* hpsb_highlevel list */

	struct hpsb_address_ops *op;

	struct hpsb_host *host;

        /* first address handled and first address behind, quadlet aligned */
        u64 start, end;
	u64 start;	/* first address handled, quadlet aligned */
	u64 end;	/* first address behind, quadlet aligned */
};


/*
 * The above structs are internal to highlevel driver handling.  Only the
 * following structures are of interest to actual highlevel drivers.
 */
/* Only the following structures are of interest to actual highlevel drivers. */

struct hpsb_highlevel {
	struct module *owner;
@@ -75,12 +66,12 @@ struct hpsb_address_ops {
	 * All functions shall return appropriate IEEE 1394 rcodes.
	 */

        /* These functions have to implement block reads for themselves. */
        /* These functions either return a response code
           or a negative number. In the first case a response will be generated; in the
           later case, no response will be sent and the driver, that handled the request
           will send the response itself
        */
	/* These functions have to implement block reads for themselves.
	 *
	 * These functions either return a response code or a negative number.
	 * In the first case a response will be generated.  In the latter case,
	 * no response will be sent and the driver which handled the request
	 * will send the response itself. */
	int (*read)(struct hpsb_host *host, int nodeid, quadlet_t *buffer,
		    u64 addr, size_t length, u16 flags);
	int (*write)(struct hpsb_host *host, int nodeid, int destid,
@@ -89,40 +80,41 @@ struct hpsb_address_ops {
	/* Lock transactions: write results of ext_tcode operation into
	 * *store. */
	int (*lock)(struct hpsb_host *host, int nodeid, quadlet_t *store,
                     u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags);
		    u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode,
		    u16 flags);
	int (*lock64)(struct hpsb_host *host, int nodeid, octlet_t *store,
                       u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags);
		      u64 addr, octlet_t data, octlet_t arg, int ext_tcode,
		      u16 flags);
};


void highlevel_add_host(struct hpsb_host *host);
void highlevel_remove_host(struct hpsb_host *host);
void highlevel_host_reset(struct hpsb_host *host);


/* these functions are called to handle transactions. They are called, when
   a packet arrives. The flags argument contains the second word of the first header
   quadlet of the incoming packet (containing transaction label, retry code,
   transaction code and priority). These functions either return a response code
   or a negative number. In the first case a response will be generated; in the
   later case, no response will be sent and the driver, that handled the request
   will send the response itself.
/*
 * These functions are called to handle transactions. They are called when a
 * packet arrives.  The flags argument contains the second word of the first
 * header quadlet of the incoming packet (containing transaction label, retry
 * code, transaction code and priority).  These functions either return a
 * response code or a negative number.  In the first case a response will be
 * generated.  In the latter case, no response will be sent and the driver which
 * handled the request will send the response itself.
 */
int highlevel_read(struct hpsb_host *host, int nodeid, void *data,
int highlevel_read(struct hpsb_host *host, int nodeid, void *data, u64 addr,
		   unsigned int length, u16 flags);
int highlevel_write(struct hpsb_host *host, int nodeid, int destid, void *data,
		    u64 addr, unsigned int length, u16 flags);
int highlevel_write(struct hpsb_host *host, int nodeid, int destid,
		    void *data, u64 addr, unsigned int length, u16 flags);
int highlevel_lock(struct hpsb_host *host, int nodeid, quadlet_t *store,
                   u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags);
		   u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode,
		   u16 flags);
int highlevel_lock64(struct hpsb_host *host, int nodeid, octlet_t *store,
                     u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags);
		     u64 addr, octlet_t data, octlet_t arg, int ext_tcode,
		     u16 flags);

void highlevel_iso_receive(struct hpsb_host *host, void *data,
                           size_t length);
void highlevel_iso_receive(struct hpsb_host *host, void *data, size_t length);
void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
			   void *data, size_t length);


/*
 * Register highlevel driver.  The name pointer has to stay valid at all times
 * because the string is not copied.
@@ -132,13 +124,15 @@ void hpsb_unregister_highlevel(struct hpsb_highlevel *hl);

/*
 * Register handlers for host address spaces.  Start and end are 48 bit pointers
 * and have to be quadlet aligned (end points to the first address behind the
 * handled addresses.  This function can be called multiple times for a single
 * hpsb_highlevel to implement sparse register sets.  The requested region must
 * not overlap any previously allocated region, otherwise registering will fail.
 * and have to be quadlet aligned.  Argument "end" points to the first address
 * behind the handled addresses.  This function can be called multiple times for
 * a single hpsb_highlevel to implement sparse register sets.  The requested
 * region must not overlap any previously allocated region, otherwise
 * registering will fail.
 *
 * It returns true for successful allocation.  There is no unregister function,
 * all address spaces are deallocated together with the hpsb_highlevel.
 * It returns true for successful allocation.  Address spaces can be
 * unregistered with hpsb_unregister_addrspace.  All remaining address spaces
 * are automatically deallocated together with the hpsb_highlevel.
 */
u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
					 struct hpsb_host *host,
@@ -147,7 +141,6 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
					 u64 start, u64 end);
int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
			    struct hpsb_address_ops *ops, u64 start, u64 end);

int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
			      u64 start);

@@ -160,7 +153,6 @@ int hpsb_listen_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
			   unsigned int channel);


/* Retrieve a hostinfo pointer bound to this driver/host */
void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host);

@@ -172,19 +164,24 @@ void *hpsb_create_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,
void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host);

/* Set an alternate lookup key for the hostinfo bound to this driver/host */
void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host, unsigned long key);
void hpsb_set_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host,
			   unsigned long key);

/* Retrieve the alternate lookup key for the hostinfo bound to this driver/host */
unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host);
/* Retrieve the alternate lookup key for the hostinfo bound to this
 * driver/host */
unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl,
				    struct hpsb_host *host);

/* Retrieve a hostinfo pointer bound to this driver using its alternate key */
void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key);

/* Set the hostinfo pointer to something useful. Usually follows a call to
 * hpsb_create_hostinfo, where the size is 0. */
int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host, void *data);
int hpsb_set_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host,
		      void *data);

/* Retrieve hpsb_host using a highlevel handle and a key */
struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long key);
struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl,
				      unsigned long key);

#endif /* IEEE1394_HIGHLEVEL_H */
+8 −7
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ enum devctl_cmd {

enum isoctl_cmd {
	/* rawiso API - see iso.h for the meanings of these commands
	   (they correspond exactly to the hpsb_iso_* API functions)
	 * (they correspond exactly to the hpsb_iso_* API functions)
	 * INIT = allocate resources
	 * START = begin transmission/reception
	 * STOP = halt transmission/reception
@@ -160,7 +160,8 @@ struct hpsb_host_driver {
	/* The hardware driver may optionally support a function that is used
	 * to set the hardware ConfigROM if the hardware supports handling
	 * reads to the ConfigROM on its own. */
	void (*set_hw_config_rom) (struct hpsb_host *host, quadlet_t *config_rom);
	void (*set_hw_config_rom)(struct hpsb_host *host,
				  quadlet_t *config_rom);

	/* This function shall implement packet transmission based on
	 * packet->type.  It shall CRC both parts of the packet (unless
@@ -183,7 +184,8 @@ struct hpsb_host_driver {
	  * (or -EXXX errno code) on failure. If the low-level driver does not
	  * support the new ISO API, set isoctl to NULL.
	  */
	int (*isoctl) (struct hpsb_iso *iso, enum isoctl_cmd command, unsigned long arg);
	int (*isoctl)(struct hpsb_iso *iso, enum isoctl_cmd command,
		      unsigned long arg);

	/* This function is mainly to redirect local CSR reads/locks to the iso
	 * management registers (bus manager id, bandwidth available, channels
@@ -196,7 +198,6 @@ struct hpsb_host_driver {
				 quadlet_t data, quadlet_t compare);
};


struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
				  struct device *dev);
int hpsb_add_host(struct hpsb_host *host);
+5 −4
Original line number Diff line number Diff line
/* Base file for all ieee1394 ioctl's. Linux-1394 has allocated base '#'
 * with a range of 0x00-0x3f. */
/*
 * Base file for all ieee1394 ioctl's.
 * Linux-1394 has allocated base '#' with a range of 0x00-0x3f.
 */

#ifndef __IEEE1394_IOCTL_H
#define __IEEE1394_IOCTL_H
@@ -99,5 +101,4 @@
#define RAW1394_IOC_ISO_RECV_FLUSH		\
	_IO  ('#', 0x29)


#endif /* __IEEE1394_IOCTL_H */
Loading