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 Original line Diff line number Diff line
@@ -39,7 +39,7 @@
/* IEEE 1394 bus specific Configuration ROM Key IDs */
/* IEEE 1394 bus specific Configuration ROM Key IDs */
#define IEEE1394_KV_ID_POWER_REQUIREMENTS (0x30)
#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_BUS_INFO_SIZE (5 * sizeof(quadlet_t))


#define CSR_IRMC_SHIFT			31
#define CSR_IRMC_SHIFT			31
@@ -64,7 +64,7 @@ struct csr_control {
	quadlet_t state;
	quadlet_t state;
	quadlet_t node_ids;
	quadlet_t node_ids;
	quadlet_t split_timeout_hi, split_timeout_lo;
	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 cycle_time;
	quadlet_t bus_time;
	quadlet_t bus_time;
	quadlet_t bus_manager_id;
	quadlet_t bus_manager_id;
+50 −31
Original line number Original line Diff line number Diff line
@@ -13,66 +13,85 @@
#include <linux/pci.h>
#include <linux/pci.h>
#include <asm/scatterlist.h>
#include <asm/scatterlist.h>


/* struct dma_prog_region
/**

 * struct dma_prog_region - small contiguous DMA buffer
   a small, physically-contiguous DMA buffer with random-access,
 * @kvirt:    kernel virtual address
   synchronous usage characteristics
 * @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 {
struct dma_prog_region {
	unsigned char    *kvirt;     /* kernel virtual address */
	unsigned char *kvirt;
	struct pci_dev   *dev;       /* PCI device */
	struct pci_dev *dev;
	unsigned int      n_pages;   /* # of kernel pages */
	unsigned int n_pages;
	dma_addr_t        bus_addr;  /* base bus address */
	dma_addr_t bus_addr;
};
};


/* clear out all fields but do not allocate any memory */
/* clear out all fields but do not allocate any memory */
void dma_prog_region_init(struct dma_prog_region *prog);
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);
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;
	return prog->bus_addr + offset;
}
}


/* struct dma_region
/**

 * struct dma_region - large non-contiguous DMA buffer
   a large, non-physically-contiguous DMA buffer with streaming,
 * @virt:        kernel virtual address
   asynchronous usage characteristics
 * @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 {
struct dma_region {
	unsigned char      *kvirt;       /* kernel virtual address */
	unsigned char *kvirt;
	struct pci_dev     *dev;         /* PCI device */
	struct pci_dev *dev;
	unsigned int        n_pages;     /* # of kernel pages */
	unsigned int n_pages;
	unsigned int        n_dma_pages; /* # of IOMMU pages */
	unsigned int n_dma_pages;
	struct scatterlist *sglist;      /* IOMMU mapping */
	struct scatterlist *sglist;
	int                 direction;   /* PCI_DMA_TODEVICE, etc */
	int direction;
};
};


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


/* allocate the buffer and map it to the IOMMU */
/* 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 */
/* unmap and free the buffer */
void dma_region_free(struct dma_region *dma);
void dma_region_free(struct dma_region *dma);


/* sync the CPU's view of the buffer */
/* 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 */
/* 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 */
/* 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) */
/* 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
/* return the DMA bus address of the byte with the given offset
   relative to the beginning of the dma_region */
 * relative to the beginning of the dma_region */
dma_addr_t dma_region_offset_to_bus(struct dma_region *dma, unsigned long offset);
dma_addr_t dma_region_offset_to_bus(struct dma_region *dma,
				    unsigned long offset);


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

#ifndef IEEE1394_HIGHLEVEL_H
#ifndef IEEE1394_HIGHLEVEL_H
#define IEEE1394_HIGHLEVEL_H
#define IEEE1394_HIGHLEVEL_H



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

	struct list_head hl_list;	/* hpsb_highlevel list */
	struct list_head hl_list;	/* hpsb_highlevel list */

	struct hpsb_address_ops *op;
	struct hpsb_address_ops *op;

	struct hpsb_host *host;
	struct hpsb_host *host;

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



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


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


        /* These functions have to implement block reads for themselves. */
	/* 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
	 * These functions either return a response code or a negative number.
           later case, no response will be sent and the driver, that handled the request
	 * In the first case a response will be generated.  In the latter case,
           will send the response itself
	 * 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,
	int (*read)(struct hpsb_host *host, int nodeid, quadlet_t *buffer,
		    u64 addr, size_t length, u16 flags);
		    u64 addr, size_t length, u16 flags);
	int (*write)(struct hpsb_host *host, int nodeid, int destid,
	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
	/* Lock transactions: write results of ext_tcode operation into
	 * *store. */
	 * *store. */
	int (*lock)(struct hpsb_host *host, int nodeid, quadlet_t *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,
	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_add_host(struct hpsb_host *host);
void highlevel_remove_host(struct hpsb_host *host);
void highlevel_remove_host(struct hpsb_host *host);
void highlevel_host_reset(struct hpsb_host *host);
void highlevel_host_reset(struct hpsb_host *host);



/*
/* these functions are called to handle transactions. They are called, when
 * These functions are called to handle transactions. They are called when a
   a packet arrives. The flags argument contains the second word of the first header
 * packet arrives.  The flags argument contains the second word of the first
   quadlet of the incoming packet (containing transaction label, retry code,
 * header quadlet of the incoming packet (containing transaction label, retry
   transaction code and priority). These functions either return a response code
 * code, transaction code and priority).  These functions either return a
   or a negative number. In the first case a response will be generated; in the
 * response code or a negative number.  In the first case a response will be
   later case, no response will be sent and the driver, that handled the request
 * generated.  In the latter case, no response will be sent and the driver which
   will send the response itself.
 * 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);
		    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,
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,
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,
void highlevel_iso_receive(struct hpsb_host *host, void *data, size_t length);
                           size_t length);
void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
void highlevel_fcp_request(struct hpsb_host *host, int nodeid, int direction,
			   void *data, size_t length);
			   void *data, size_t length);



/*
/*
 * Register highlevel driver.  The name pointer has to stay valid at all times
 * Register highlevel driver.  The name pointer has to stay valid at all times
 * because the string is not copied.
 * 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
 * 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
 * and have to be quadlet aligned.  Argument "end" points to the first address
 * handled addresses.  This function can be called multiple times for a single
 * behind the handled addresses.  This function can be called multiple times for
 * hpsb_highlevel to implement sparse register sets.  The requested region must
 * a single hpsb_highlevel to implement sparse register sets.  The requested
 * not overlap any previously allocated region, otherwise registering will fail.
 * region must not overlap any previously allocated region, otherwise
 * registering will fail.
 *
 *
 * It returns true for successful allocation.  There is no unregister function,
 * It returns true for successful allocation.  Address spaces can be
 * all address spaces are deallocated together with the hpsb_highlevel.
 * 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,
u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
					 struct hpsb_host *host,
					 struct hpsb_host *host,
@@ -147,7 +141,6 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
					 u64 start, u64 end);
					 u64 start, u64 end);
int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
			    struct hpsb_address_ops *ops, u64 start, u64 end);
			    struct hpsb_address_ops *ops, u64 start, u64 end);

int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
int hpsb_unregister_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
			      u64 start);
			      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,
void hpsb_unlisten_channel(struct hpsb_highlevel *hl, struct hpsb_host *host,
			   unsigned int channel);
			   unsigned int channel);



/* Retrieve a hostinfo pointer bound to this driver/host */
/* Retrieve a hostinfo pointer bound to this driver/host */
void *hpsb_get_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *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);
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 */
/* 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 */
/* Retrieve the alternate lookup key for the hostinfo bound to this
unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host);
 * 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 */
/* Retrieve a hostinfo pointer bound to this driver using its alternate key */
void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long 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
/* Set the hostinfo pointer to something useful. Usually follows a call to
 * hpsb_create_hostinfo, where the size is 0. */
 * 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 */
/* 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 */
#endif /* IEEE1394_HIGHLEVEL_H */
+8 −7
Original line number Original line Diff line number Diff line
@@ -112,7 +112,7 @@ enum devctl_cmd {


enum isoctl_cmd {
enum isoctl_cmd {
	/* rawiso API - see iso.h for the meanings of these commands
	/* 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
	 * INIT = allocate resources
	 * START = begin transmission/reception
	 * START = begin transmission/reception
	 * STOP = halt 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
	/* The hardware driver may optionally support a function that is used
	 * to set the hardware ConfigROM if the hardware supports handling
	 * to set the hardware ConfigROM if the hardware supports handling
	 * reads to the ConfigROM on its own. */
	 * 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
	/* This function shall implement packet transmission based on
	 * packet->type.  It shall CRC both parts of the packet (unless
	 * 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
	  * (or -EXXX errno code) on failure. If the low-level driver does not
	  * support the new ISO API, set isoctl to NULL.
	  * 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
	/* This function is mainly to redirect local CSR reads/locks to the iso
	 * management registers (bus manager id, bandwidth available, channels
	 * management registers (bus manager id, bandwidth available, channels
@@ -196,7 +198,6 @@ struct hpsb_host_driver {
				 quadlet_t data, quadlet_t compare);
				 quadlet_t data, quadlet_t compare);
};
};



struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
struct hpsb_host *hpsb_alloc_host(struct hpsb_host_driver *drv, size_t extra,
				  struct device *dev);
				  struct device *dev);
int hpsb_add_host(struct hpsb_host *host);
int hpsb_add_host(struct hpsb_host *host);
+5 −4
Original line number Original line 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
#ifndef __IEEE1394_IOCTL_H
#define __IEEE1394_IOCTL_H
#define __IEEE1394_IOCTL_H
@@ -99,5 +101,4 @@
#define RAW1394_IOC_ISO_RECV_FLUSH		\
#define RAW1394_IOC_ISO_RECV_FLUSH		\
	_IO  ('#', 0x29)
	_IO  ('#', 0x29)



#endif /* __IEEE1394_IOCTL_H */
#endif /* __IEEE1394_IOCTL_H */
Loading