]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
staging: apf: Fixed alignment of ioctl args
authorMichael Gill <michael.gill@xilinx.com>
Tue, 12 Apr 2016 04:24:03 +0000 (21:24 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 12 Apr 2016 05:20:00 +0000 (07:20 +0200)
Some changes to the user-space code resulted in a shift in the
alignment of several arguments in structures that are used
to communicate to the apf kernel driver via ioctl.  This mirrors
those changes in the kernel code.

Signed-off-by: Michael Gill <gill@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/staging/apf/xilinx-dma-apf.c
drivers/staging/apf/xlnk.c
drivers/staging/apf/xlnk.h

index b0de6a20dd712483b865da21d530a1b0befb76e9..06363cc2bea72a6c90bd5c0e04ab7dd8174848d9 100644 (file)
@@ -782,7 +782,6 @@ int xdma_submit(struct xdma_chan *chan,
        unsigned int sgcnt, sgcnt_dma;
        enum dma_data_direction dmadir;
        int status;
-       void *kaddr;
        DEFINE_DMA_ATTRS(attrs);
 
 
@@ -829,6 +828,7 @@ int xdma_submit(struct xdma_chan *chan,
                sglist_dma = sglist;
                sgcnt_dma = sgcnt;
                if (user_flags & CF_FLAG_CACHE_FLUSH_INVALIDATE) {
+                       void *kaddr = phys_to_virt((phys_addr_t)userbuf);
                        __cpuc_flush_dcache_area(kaddr, size);
                        outer_clean_range((phys_addr_t)userbuf,
                                          (u32)userbuf + size);
index 4243586ac1888f7c4f017bc073f6dab5acf3ae92..2c6c36817eebbf50b210cccc8ddcd54d07b698d4 100644 (file)
@@ -636,7 +636,7 @@ static int xlnk_dmaregister(char *name, unsigned int id,
                          GFP_KERNEL);
        if (!devpack)
                return -ENOMEM;
-
+       strcpy(devpack->name, name);
        devpack->pdev.name = "xilinx-axidma";
 
        devpack->pdev.id = id;
@@ -1245,7 +1245,6 @@ static long xlnk_ioctl(struct file *filp, unsigned int code,
                status = xlnk_recover_resource(args);
                break;
        default:
-               pr_err("xlnk- Unknown ioctl code emitted\n");
                status = -EINVAL;
        }
 
index 2939e63df8c9e4e4b125a13aaeaa8c69393ca293..ac20c2a7dcad52de139208348c8b42348cab6d75 100644 (file)
@@ -13,7 +13,6 @@
 #define CF_FLAG_PHYSICALLY_CONTIGUOUS  0x00000002
 #define CF_FLAG_DMAPOLLING             0x00000004
 
-
 enum xlnk_dma_direction {
        XLNK_DMA_BI = 0,
        XLNK_DMA_TO_DEVICE = 1,
@@ -38,95 +37,104 @@ struct xlnk_dmabuf_reg {
 };
 
 union xlnk_args {
-       struct {
-               unsigned int len;
-               int id;
-               unsigned int phyaddr;
+       struct __attribute__ ((__packed__))  {
+               __aligned(4) unsigned int len;
+               __aligned(4) int id;
+               __aligned(4) unsigned int phyaddr;
                unsigned char cacheable;
        } allocbuf;
-       struct {
-               unsigned int id;
-               void *buf;
+       struct __attribute__ ((__packed__))  {
+               __aligned(4) unsigned int id;
+               __aligned(4) void *buf;
        } freebuf;
-       struct {
-               int dmabuf_fd;
-               void *user_addr;
+       struct __attribute__ ((__packed__))  {
+               __aligned(4) int dmabuf_fd;
+               __aligned(4) void *user_addr;
        } dmabuf;
-       struct {
+       struct __attribute__ ((__packed__))  {
                char name[64]; /* max length of 64 */
-               u32 dmachan; /* return value */
-               unsigned int bd_space_phys_addr;/*for bd chain used by dmachan*/
-               unsigned int bd_space_size; /* bd chain size in bytes */
+               /* return value */
+               __aligned(4) unsigned int dmachan;
+               /*for bd chain used by dmachan*/
+               __aligned(4) unsigned int bd_space_phys_addr;
+               /* bd chain size in bytes */
+               __aligned(4) unsigned int bd_space_size;
        } dmarequest;
 #define XLNK_MAX_APPWORDS 5
-       struct {
-               u32 dmachan;
-               void *buf;      /* buffer base address */
-               void *buf2;     /* used to point src_buf in cdma case */
-               unsigned int buf_offset; /* used on kernel allocated buffers */
-               unsigned int len;
-               unsigned int bufflag; /* zero all the time so far */
-               u32 sglist; /* ignored */
-               unsigned int sgcnt; /* ignored */
-               enum xlnk_dma_direction dmadir;
-               unsigned int nappwords_i; /* n appwords passed to BD */
-               unsigned int appwords_i[XLNK_MAX_APPWORDS];
-               unsigned int nappwords_o; /* n appwords passed from BD */
+       struct __attribute__ ((__packed__))  {
+               __aligned(4) unsigned int dmachan;
+               /* buffer base address */
+               __aligned(4) void *buf;
+               /* used to point src_buf in cdma case */
+               __aligned(4) void *buf2;
+               /* used on kernel allocated buffers */
+               __aligned(4) unsigned int buf_offset;
+               __aligned(4) unsigned int len;
+               /* zero all the time so far */
+               __aligned(4) unsigned int bufflag;
+               __aligned(4) unsigned int sglist; /* ignored */
+               __aligned(4) unsigned int sgcnt; /* ignored */
+               __aligned(4) int dmadir;
+               __aligned(4) unsigned int nappwords_i;
+               __aligned(4) unsigned int appwords_i[XLNK_MAX_APPWORDS];
+               __aligned(4) unsigned int nappwords_o;
                /* appwords array we only accept 5 max */
-               unsigned int flag;
-               u32 dmahandle; /* return value */
-               unsigned int last_bd_index; /*index of last bd used by request*/
+               __aligned(4) unsigned int flag;
+               /* return value */
+               __aligned(4) unsigned int dmahandle;
+               /*index of last bd used by request*/
+               __aligned(4) unsigned int last_bd_index;
        } dmasubmit;
-       struct {
-               u32 dmahandle;
-               unsigned int nappwords; /* n appwords read from BD */
-               unsigned int appwords[XLNK_MAX_APPWORDS];
+       struct __attribute__ ((__packed__))  {
+               __aligned(4) unsigned int dmahandle;
+               __aligned(4) unsigned int nappwords;
+               __aligned(4) unsigned int appwords[XLNK_MAX_APPWORDS];
                /* appwords array we only accept 5 max */
        } dmawait;
-       struct {
-               u32 dmachan;
+       struct __attribute__ ((__packed__))  {
+               __aligned(4) unsigned int dmachan;
        } dmarelease;
-       struct {
-               unsigned int base;
-               unsigned int size;
-               unsigned int irqs[8];
+       struct __attribute__ ((__packed__))  {
+               __aligned(4) unsigned int base;
+               __aligned(4) unsigned int size;
+               __aligned(4) unsigned int irqs[8];
                char name[32];
-               unsigned int id;
+               __aligned(4) unsigned int id;
        } devregister;
-       struct {
-               unsigned int base;
+       struct __attribute__ ((__packed__))  {
+               __aligned(4) unsigned int base;
        } devunregister;
-       struct {
+       struct __attribute__ ((__packed__))  {
                char name[32];
-               unsigned int id;
-               unsigned int base;
-               unsigned int size;
-               unsigned int chan_num;
-               unsigned int chan0_dir;
-               unsigned int chan0_irq;
-               unsigned int chan0_poll_mode;
-               unsigned int chan0_include_dre;
-               unsigned int chan0_data_width;
-               unsigned int chan1_dir;
-               unsigned int chan1_irq;
-               unsigned int chan1_poll_mode;
-               unsigned int chan1_include_dre;
-               unsigned int chan1_data_width;
+               __aligned(4) unsigned int id;
+               __aligned(4) unsigned int base;
+               __aligned(4) unsigned int size;
+               __aligned(4) unsigned int chan_num;
+               __aligned(4) unsigned int chan0_dir;
+               __aligned(4) unsigned int chan0_irq;
+               __aligned(4) unsigned int chan0_poll_mode;
+               __aligned(4) unsigned int chan0_include_dre;
+               __aligned(4) unsigned int chan0_data_width;
+               __aligned(4) unsigned int chan1_dir;
+               __aligned(4) unsigned int chan1_irq;
+               __aligned(4) unsigned int chan1_poll_mode;
+               __aligned(4) unsigned int chan1_include_dre;
+               __aligned(4) unsigned int chan1_data_width;
        } dmaregister;
-       struct {
+       struct __attribute__ ((__packed__))  {
                char name[32];
-               unsigned int id;
-               unsigned int base;
-               unsigned int size;
-               unsigned int mm2s_chan_num;
-               unsigned int mm2s_chan_irq;
-               unsigned int s2mm_chan_num;
-               unsigned int s2mm_chan_irq;
+               __aligned(4) unsigned int id;
+               __aligned(4) unsigned int base;
+               __aligned(4) unsigned int size;
+               __aligned(4) unsigned int mm2s_chan_num;
+               __aligned(4) unsigned int mm2s_chan_irq;
+               __aligned(4) unsigned int s2mm_chan_num;
+               __aligned(4) unsigned int s2mm_chan_irq;
        } mcdmaregister;
-       struct {
-               void *phys_addr;
-               int size;
-               int action;
+       struct __attribute__ ((__packed__))  {
+               __aligned(4) void *phys_addr;
+               __aligned(4) int size;
+               __aligned(4) int action;
        } cachecontrol;
 };