Re: [PATCH 6/6] staging: most: Documentation: add information to driver_usage file

2018-12-14 Thread Christian.Gromm
On Do, 2018-12-13 at 18:55 +0100, Greg KH wrote:
> On Thu, Dec 13, 2018 at 04:32:25PM +, Christian.Gromm@microchip.c
> om wrote:
> > 
> > On Do, 2018-12-13 at 13:32 +0100, Greg KH wrote:
> > > 
> > > On Thu, Dec 13, 2018 at 02:58:00PM +0300, Dan Carpenter wrote:
> > > > 
> > > > 
> > > > On Wed, Dec 12, 2018 at 01:15:31PM +0100, Christian Gromm
> > > > wrote:
> > > > > 
> > > > > 
> > > > > This patch updates driver_usage.txt file to reflect the
> > > > > latest
> > > > > changes
> > > > > that this patch set introduces.
> > > > > 
> > > > > Signed-off-by: Christian Gromm  > > > > >
> > > > > ---
> > > > >  drivers/staging/most/Documentation/driver_usage.txt | 16
> > > > > +---
> > > > >  1 file changed, 13 insertions(+), 3 deletions(-)
> > > > > 
> > > > > diff --git
> > > > > a/drivers/staging/most/Documentation/driver_usage.txt
> > > > > b/drivers/staging/most/Documentation/driver_usage.txt
> > > > > index bb9b4e8..da7a8f4 100644
> > > > > --- a/drivers/staging/most/Documentation/driver_usage.txt
> > > > > +++ b/drivers/staging/most/Documentation/driver_usage.txt
> > > > > @@ -142,8 +142,9 @@ Cdev component example:
> > > > >  
> > > > >  Sound component example:
> > > > >  
> > > > > -The sound component needs an additional parameter to
> > > > > determine
> > > > > the audio
> > > > > -resolution that is going to be used. The following formats
> > > > > are
> > > > > available:
> > > > > +The sound component needs additional parameters to determine
> > > > > the
> > > > > audio
> > > > > +resolution that is going to be used and to trigger the
> > > > > registration of a
> > > > > +sound card with ALSA. The following audio formats are
> > > > > available:
> > > > >  
> > > > >   - "1x8" (Mono)
> > > > >   - "2x16" (16-bit stereo)
> > > > > @@ -151,9 +152,18 @@ resolution that is going to be used. The
> > > > > following formats are available:
> > > > >   - "2x32" (32-bit stereo)
> > > > >   - "6x16" (16-bit surround 5.1)
> > > > >  
> > > > > -$ echo "mdev0:ep_81:sound:most51_playback.6x16"
> > > > > > 
> > > > > > $(DRV_DIR)/add_link
> > > > > +To make the sound module create a sound card and register it
> > > > > with ALSA the
> > > > > +string "create" needs to be attached to the module parameter
> > > > > section of the
> > > > > +configuration string. To create a sound card with with two
> > > > > playback devices
> > > > > +(linked to channel ep01 and ep02) and one capture device
> > > > > (linked
> > > > > to channel
> > > > > +ep83) the following is written to the add_link file:
> > > > >  
> > > > > +$ echo "mdev0:ep01:sound:most51_playback.6x16"
> > > > > > 
> > > > > > $(DRV_DIR)/add_link
> > > > > +$ echo "mdev0:ep02:sound:most_playback.2x16"
> > > > > > 
> > > > > > $(DRV_DIR)/add_link
> > > > > +$ echo "mdev0:ep83:sound:most_capture.2x16.create"
> > > > > > 
> > > > > > $(DRV_DIR)/add_link
> > > > I would maybe prefer if the "create" command were on a separate
> > > > line.
> > > > Something like:
> > > > 
> > > > +$ echo "mdev0:ep01:sound:most51_playback.6x16"
> > > > > 
> > > > > $(DRV_DIR)/add_link
> > > > +$ echo "mdev0:ep02:sound:most_playback.2x16"
> > > > > 
> > > > > $(DRV_DIR)/add_link
> > > > +$ echo "mdev0:ep83:sound:most_capture.2x16"
> > > > > 
> > > > > $(DRV_DIR)/add_link
> > > > +$ echo "mdev0:ep83:sound:create"
> > > > >$(DRV_DIR)/sound_card
> > > > 
> > > > It's sort of a separate command in a way?
> > > Why is sysfs being used for configuring things?  Isn't that what
> > > configfs was created for?  :)
> > > 
> > Omg, that would be one API change!
> > 
> > I need to dig a little deeper into configfs to recognize
> > its beauty and the possible benefit for our driver.
> > 
> > Do you see this as a prerequisite?  
> Writing random strings to a random sysfs file to configure things is
> not
> a "normal" user/kernel api as sysfs files are supposed to just be
> "one
> value" and not parsed like what you are doing here.
> 
> So I would strongly suggest looking at configfs, that is what it was
> designed for.
> 

Message received. Anyway, I would like to resent the current
patch set with the things Dan found fixed. And then looking
into Configfs. Would this be ok for you guys?

thanks,
Chris
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 6/6] staging: most: Documentation: add information to driver_usage file

2018-12-14 Thread Dan Carpenter
On Fri, Dec 14, 2018 at 09:06:01AM +, christian.gr...@microchip.com wrote:
> Message received. Anyway, I would like to resent the current
> patch set with the things Dan found fixed. And then looking
> into Configfs. Would this be ok for you guys?
> 

Sure.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 6/6] staging: most: Documentation: add information to driver_usage file

2018-12-14 Thread Christian.Gromm
On Fr, 2018-12-14 at 12:10 +0300, Dan Carpenter wrote:
> On Fri, Dec 14, 2018 at 09:06:01AM +, Christian.Gromm@microchip.c
> om wrote:
> > 
> > Message received. Anyway, I would like to resent the current
> > patch set with the things Dan found fixed. And then looking
> > into Configfs. Would this be ok for you guys?
> > 
> Sure.
> 

I'm not sure what is the best way to resend this.

Can you skip the series and I'm going to send an entire
new one. Or should I create a v2 of some of the patches
of the series and only resend those and you keep the others?
 

thanks,
Chris
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 6/6] staging: most: Documentation: add information to driver_usage file

2018-12-14 Thread Dan Carpenter
On Fri, Dec 14, 2018 at 09:33:50AM +, christian.gr...@microchip.com wrote:
> On Fr, 2018-12-14 at 12:10 +0300, Dan Carpenter wrote:
> > On Fri, Dec 14, 2018 at 09:06:01AM +, Christian.Gromm@microchip.c
> > om wrote:
> > > 
> > > Message received. Anyway, I would like to resent the current
> > > patch set with the things Dan found fixed. And then looking
> > > into Configfs. Would this be ok for you guys?
> > > 
> > Sure.
> > 
> 
> I'm not sure what is the best way to resend this.
> 
> Can you skip the series and I'm going to send an entire
> new one. Or should I create a v2 of some of the patches
> of the series and only resend those and you keep the others?
>  

Please resend the whole patchset.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 6/6] staging: most: Documentation: add information to driver_usage file

2018-12-14 Thread Greg KH
On Fri, Dec 14, 2018 at 09:33:50AM +, christian.gr...@microchip.com wrote:
> On Fr, 2018-12-14 at 12:10 +0300, Dan Carpenter wrote:
> > On Fri, Dec 14, 2018 at 09:06:01AM +, Christian.Gromm@microchip.c
> > om wrote:
> > > 
> > > Message received. Anyway, I would like to resent the current
> > > patch set with the things Dan found fixed. And then looking
> > > into Configfs. Would this be ok for you guys?
> > > 
> > Sure.
> > 
> 
> I'm not sure what is the best way to resend this.
> 
> Can you skip the series and I'm going to send an entire
> new one. Or should I create a v2 of some of the patches
> of the series and only resend those and you keep the others?

Send a whole new v2 of this series, I'll drop the first one.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] binder: implement binderfs

2018-12-14 Thread Christian Brauner
On Fri, Dec 14, 2018 at 10:11:23AM +0300, Dan Carpenter wrote:
> On Thu, Dec 13, 2018 at 10:59:11PM +0100, Christian Brauner wrote:
> > +/**
> > + * binderfs_new_inode - allocate inode from super block of a binderfs mount
> > + * @ref_inode: inode from wich the super block will be taken
> > + * @userp: buffer to copy information about new device for userspace to
> > + * @device:binder device for which the new inode will be allocated
> > + * @req:   struct binderfs_device as copied from userspace
> > + *
> > + * This function will allocate a new inode from the super block of the
> > + * filesystem mount and attach a dentry to that inode.
> > + * Minor numbers are limited and tracked globally in binderfs_minors.
> > + * The function will stash a struct binder_device for the specific binder
> > + * device in i_private of the inode.
> > + *
> > + * Return: 0 on success, negative errno on failure
> > + */
> > +static int binderfs_new_inode(struct inode *ref_inode,
> > + struct binder_device *device,
> > + struct binderfs_device __user *userp,
> > + struct binderfs_device *req)
> > +{
> > +   int minor, ret;
> > +   struct dentry *dentry, *dup, *root;
> > +   size_t name_len = BINDERFS_MAX_NAME + 1;
> > +   char *name = NULL;
> > +   struct inode *inode = NULL;
> > +   struct super_block *sb = ref_inode->i_sb;
> > +   struct binderfs_info *info = sb->s_fs_info;
> > +
> > +   /* Reserve new minor number for the new device. */
> > +   mutex_lock(&binderfs_minors_mutex);
> > +   minor = ida_alloc_max(&binderfs_minors, BINDERFS_MAX_MINOR, GFP_KERNEL);
> > +   mutex_unlock(&binderfs_minors_mutex);
> > +   if (minor < 0)
> > +   return minor;
> > +
> > +   ret = -ENOMEM;
> > +   inode = new_inode(sb);
> > +   if (!inode)
> > +   goto err;
> > +
> > +   inode->i_ino = minor + INODE_OFFSET;
> > +   inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
> > +   init_special_inode(inode, S_IFCHR | 0600,
> > +  MKDEV(MAJOR(binderfs_dev), minor));
> > +   inode->i_fop = &binder_fops;
> > +   inode->i_uid = info->root_uid;
> > +   inode->i_gid = info->root_gid;
> > +   inode->i_private = device;
> > +
> > +   name = kmalloc(name_len, GFP_KERNEL);
> > +   if (!name)
> > +   goto err;
> > +
> > +   ret = snprintf(name, name_len, "%s", req->name);
> > +   if (ret < 0 || (size_t)ret >= name_len) {
> 
> kernel snprintf() doesn't return negatives and the cast isn't required
> either.

Good point. But I'd rather replace it with:
strscpy(name, req->name, name_len);
which is syntactically and semantically cleaner.

> 
> > +   ret = -EINVAL;
> > +   goto err;
> > +   }
> > +
> > +   device->binderfs_inode = inode;
> > +   device->context.binder_context_mgr_uid = INVALID_UID;
> > +   device->context.name = name;
> > +   device->miscdev.name = name;
> > +   device->miscdev.minor = minor;
> > +   mutex_init(&device->context.context_mgr_node_lock);
> > +
> > +   req->major = MAJOR(binderfs_dev);
> > +   req->minor = minor;
> > +
> > +   ret = copy_to_user(userp, req, sizeof(*req));
> > +   if (ret)
> > +   goto err;
> 
> copy_to_user() returns the number of bytes remaining.
> 
>   ret = -EFAULT;
>   if (copy_to_user(userp, req, sizeof(*req)))
>   goto err;
> 
> Also if this copy_to_user() fails, then does the kfree(name) and the
> iput(inode) lead to a double free of name in binderfs_evict_inode()?

I'm going to defer setting inode->i_private in all codepaths right
before d_add() after which no error handling occurs any more.

> 
> > +
> > +   root = sb->s_root;
> > +   inode_lock(d_inode(root));
> > +   dentry = d_alloc_name(root, name);
> > +   if (!dentry) {
> > +   inode_unlock(d_inode(root));
> > +   ret = -ENOMEM;
> > +   goto err;
> > +   }
> > +
> > +   /* Verify that the name userspace gave us is not already in use. */
> > +   dup = d_lookup(root, &dentry->d_name);
> > +   if (dup) {
> > +   if (d_really_is_positive(dup)) {
> > +   dput(dup);
> > +   dput(dentry);
> > +   inode_unlock(d_inode(root));
> > +   /*
> > +* Prevent double free since iput() calls
> > +* binderfs_evict_inode().
> > +*/
> > +   inode->i_private = NULL;
> > +   ret = -EEXIST;
> > +   goto err;
> > +   }
> > +   dput(dup);
> > +   }
> > +
> > +   d_add(dentry, inode);
> > +   fsnotify_create(root->d_inode, dentry);
> > +   inode_unlock(d_inode(root));
> > +
> > +   return 0;
> > +
> > +err:
> > +   kfree(name);
> > +   mutex_lock(&binderfs_minors_mutex);
> > +   ida_free(&binderfs_minors, minor);
> > +   mutex_unlock(&binderfs_minors_mutex);
> > +   iput(inode);
> > +
> > +   return ret;
> > +}
> > +
> > +static int binderfs_binder_device_create(struct ino

[PATCH v2 01/33] staging: vc04_services: Remove DUMP_CONTEXT_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 2833f93bbc74..fa15033daf5f 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -154,12 +154,12 @@ struct vchiq_instance_struct {
VCHIQ_DEBUGFS_NODE_T debugfs_node;
 };
 
-typedef struct dump_context_struct {
+struct dump_context {
char __user *buf;
size_t actual;
size_t space;
loff_t offset;
-} DUMP_CONTEXT_T;
+};
 
 static struct cdevvchiq_cdev;
 static dev_t  vchiq_devid;
@@ -2113,7 +2113,7 @@ static int vchiq_release(struct inode *inode, struct file 
*file)
 void
 vchiq_dump(void *dump_context, const char *str, int len)
 {
-   DUMP_CONTEXT_T *context = (DUMP_CONTEXT_T *)dump_context;
+   struct dump_context *context = (struct dump_context *)dump_context;
 
if (context->actual < context->space) {
int copy_bytes;
@@ -2241,7 +2241,7 @@ static ssize_t
 vchiq_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
 {
-   DUMP_CONTEXT_T context;
+   struct dump_context context;
 
context.buf = buf;
context.actual = 0;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 03/33] staging: vc04_services: Remove REMOTE_EVENT_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_2835_arm.c   |  2 +-
 .../vc04_services/interface/vchiq_arm/vchiq_core.c |  8 
 .../vc04_services/interface/vchiq_arm/vchiq_core.h | 14 +++---
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 6eaaab8165bf..ae410fd2b314 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -234,7 +234,7 @@ vchiq_platform_get_arm_state(VCHIQ_STATE_T *state)
 }
 
 void
-remote_event_signal(REMOTE_EVENT_T *event)
+remote_event_signal(struct remote_event *event)
 {
wmb();
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 9818e56d752f..627ae8f7b082 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -418,7 +418,7 @@ vchiq_set_conn_state(VCHIQ_STATE_T *state, 
VCHIQ_CONNSTATE_T newstate)
 }
 
 static inline void
-remote_event_create(wait_queue_head_t *wq, REMOTE_EVENT_T *event)
+remote_event_create(wait_queue_head_t *wq, struct remote_event *event)
 {
event->armed = 0;
/* Don't clear the 'fired' flag because it may already have been set
@@ -427,7 +427,7 @@ remote_event_create(wait_queue_head_t *wq, REMOTE_EVENT_T 
*event)
 }
 
 static inline int
-remote_event_wait(wait_queue_head_t *wq, REMOTE_EVENT_T *event)
+remote_event_wait(wait_queue_head_t *wq, struct remote_event *event)
 {
if (!event->fired) {
event->armed = 1;
@@ -445,14 +445,14 @@ remote_event_wait(wait_queue_head_t *wq, REMOTE_EVENT_T 
*event)
 }
 
 static inline void
-remote_event_signal_local(wait_queue_head_t *wq, REMOTE_EVENT_T *event)
+remote_event_signal_local(wait_queue_head_t *wq, struct remote_event *event)
 {
event->armed = 0;
wake_up_all(wq);
 }
 
 static inline void
-remote_event_poll(wait_queue_head_t *wq, REMOTE_EVENT_T *event)
+remote_event_poll(wait_queue_head_t *wq, struct remote_event *event)
 {
if (event->fired && event->armed)
remote_event_signal_local(wq, event);
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index aae2c59700bd..f4e950fe77ff 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -260,11 +260,11 @@ typedef struct vchiq_bulk_queue_struct {
VCHIQ_BULK_T bulks[VCHIQ_NUM_SERVICE_BULKS];
 } VCHIQ_BULK_QUEUE_T;
 
-typedef struct remote_event_struct {
+struct remote_event {
int armed;
int fired;
u32 __unused;
-} REMOTE_EVENT_T;
+};
 
 typedef struct opaque_platform_state_t *VCHIQ_PLATFORM_STATE_T;
 
@@ -355,7 +355,7 @@ typedef struct vchiq_shared_state_struct {
 
/* Signalling this event indicates that owner's slot handler thread
** should run. */
-   REMOTE_EVENT_T trigger;
+   struct remote_event trigger;
 
/* Indicates the byte position within the stream where the next message
** will be written. The least significant bits are an index into the
@@ -363,17 +363,17 @@ typedef struct vchiq_shared_state_struct {
int tx_pos;
 
/* This event should be signalled when a slot is recycled. */
-   REMOTE_EVENT_T recycle;
+   struct remote_event recycle;
 
/* The slot_queue index where the next recycled slot will be written. */
int slot_queue_recycle;
 
/* This event should be signalled when a synchronous message is sent. */
-   REMOTE_EVENT_T sync_trigger;
+   struct remote_event sync_trigger;
 
/* This event should be signalled when a synchronous message has been
** released. */
-   REMOTE_EVENT_T sync_release;
+   struct remote_event sync_release;
 
/* A circular buffer of slot indexes. */
int slot_queue[VCHIQ_MAX_SLOTS_PER_SIDE];
@@ -623,7 +623,7 @@ extern void
 vchiq_complete_bulk(VCHIQ_BULK_T *bulk);
 
 extern void
-remote_event_signal(REMOTE_EVENT_T *event);
+remote_event_signal(struct remote_event *event);
 
 void
 vchiq_platform_check_suspend(VCHIQ_STATE_T *state);
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 04/33] staging: vc04_services: Remove SERVICE_CREATION_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 2 +-
 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c   | 2 +-
 drivers/staging/vc04_services/interface/vchi/vchi.h | 6 +++---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_shim.c  | 6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 0db412fd7c55..a1cb337192d4 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -122,7 +122,7 @@ static int
 vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance,
   struct bcm2835_audio_instance *instance)
 {
-   SERVICE_CREATION_T params = {
+   struct service_creation params = {
.version= VCHI_VERSION_EX(VC_AUDIOSERV_VER, 
VC_AUDIOSERV_MIN_VER),
.service_id = VC_AUDIO_SERVER_NAME,
.callback   = audio_vchi_callback,
diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
index bffd75da3db7..c6d06f19fc6e 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
@@ -1806,7 +1806,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance 
**out_instance)
int status;
struct vchiq_mmal_instance *instance;
static VCHI_INSTANCE_T vchi_instance;
-   SERVICE_CREATION_T params = {
+   struct service_creation params = {
.version= VCHI_VERSION_EX(VC_MMAL_VER, 
VC_MMAL_MIN_VER),
.service_id = VC_MMAL_SERVER_NAME,
.callback   = service_callback,
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index e326926eac31..ee63d2817e58 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -72,12 +72,12 @@ typedef struct {
 } VCHI_HELD_MSG_T;
 
 // structure used to provide the information needed to open a server or a 
client
-typedef struct {
+struct service_creation {
struct vchi_version version;
int32_t service_id;
VCHI_CALLBACK_T callback;
void *callback_param;
-} SERVICE_CREATION_T;
+};
 
 // Opaque handle for a VCHI instance
 typedef struct opaque_vchi_instance_handle_t *VCHI_INSTANCE_T;
@@ -117,7 +117,7 @@ extern int32_t vchi_service_destroy(const 
VCHI_SERVICE_HANDLE_T handle);
 
 // Routine to open a named service
 extern int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
-SERVICE_CREATION_T *setup,
+struct service_creation *setup,
 VCHI_SERVICE_HANDLE_T *handle);
 
 extern int32_t vchi_get_peer_version(const VCHI_SERVICE_HANDLE_T handle,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 81cac68f4b78..0971f19ec1f6 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -530,7 +530,7 @@ EXPORT_SYMBOL(vchi_disconnect);
  * Name: vchi_service_create
  *
  * Arguments: VCHI_INSTANCE_T *instance_handle
- *SERVICE_CREATION_T *setup,
+ *struct service_creation *setup,
  *VCHI_SERVICE_HANDLE_T *handle
  *
  * Description: Routine to open a service
@@ -600,7 +600,7 @@ static VCHIQ_STATUS_T shim_callback(VCHIQ_REASON_T reason,
 }
 
 static struct shim_service *service_alloc(VCHIQ_INSTANCE_T instance,
-   SERVICE_CREATION_T *setup)
+   struct service_creation *setup)
 {
struct shim_service *service = kzalloc(sizeof(struct shim_service), 
GFP_KERNEL);
 
@@ -628,7 +628,7 @@ static void service_free(struct shim_service *service)
 }
 
 int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
-   SERVICE_CREATION_T *setup,
+   struct service_creation *setup,
VCHI_SERVICE_HANDLE_T *handle)
 {
VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 00/33] staging: vc04_services: Remove most struct typedefs

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Dominic Braun (33):
  staging: vc04_services: Remove DUMP_CONTEXT_T typedef
  staging: vc04_services: Remove PAGELIST_T typedef
  staging: vc04_services: Remove REMOTE_EVENT_T typedef
  staging: vc04_services: Remove SERVICE_CREATION_T typedef
  staging: vc04_services: Remove USER_SERVICE_T typedef
  staging: vc04_services: Remove VCHI_HELD_MSG_T typedef
  staging: vc04_services: Remove VCHI_MSG_ITER_T typedef
  staging: vc04_services: Remove VCHI_MSG_VECTOR_T typedef
  staging: vc04_services: Remove VCHIQ_ARM_STATE_T typedef
  staging: vc04_services: Remove VCHIQ_AWAIT_COMPLETION_T typedef
  staging: vc04_services: Remove VCHIQ_BULK_QUEUE_T typedef
  staging: vc04_services: Remove VCHIQ_BULK_T typedef
  staging: vc04_services: Remove VCHIQ_COMPLETION_DATA_T typedef
  staging: vc04_services: Remove VCHIQ_CONFIG_T typedef
  staging: vc04_services: Remove VCHIQ_CREATE_SERVICE_T typedef
  staging: vc04_services: Remove VCHIQ_DEBUGFS_NODE_T typedef
  staging: vc04_services: Remove VCHIQ_DEQUEUE_MESSAGE_T typedef
  staging: vc04_services: Remove VCHIQ_DUMP_MEM_T typedef
  staging: vc04_services: Remove VCHIQ_GET_CONFIG_T typedef
  staging: vc04_services: Remove VCHIQ_HEADER_T typedef
  staging: vc04_services: Remove VCHIQ_QUEUE_BULK_TRANSFER_T typedef
  staging: vc04_services: Remove VCHIQ_QUEUE_MESSAGE_T typedef
  staging: vc04_services: Remove VCHIQ_SERVICE_BASE_T typedef
  staging: vc04_services: Remove VCHIQ_SERVICE_PARAMS_T typedef
  staging: vc04_services: Remove VCHIQ_SERVICE_QUOTA_T typedef
  staging: vc04_services: Remove VCHIQ_SERVICE_T typedef
  staging: vc04_services: Remove VCHIQ_SET_SERVICE_OPTION_T typedef
  staging: vc04_services: Remove VCHIQ_SHARED_STATE_T typedef
  staging: vc04_services: Remove VCHIQ_SLOT_INFO_T typedef
  staging: vc04_services: Remove VCHIQ_SLOT_T typedef
  staging: vc04_services: Remove VCHIQ_SLOT_ZERO_T
  staging: vc04_services: Remove VCHIQ_STATE_T typedef
  staging: vc04_services: Remove VCHIU_QUEUE_T typedef

 .../bcm2835-audio/bcm2835-vchiq.c |   2 +-
 .../vc04_services/bcm2835-camera/mmal-vchiq.c |  30 +-
 .../vc04_services/interface/vchi/vchi.h   |  38 +-
 .../interface/vchi/vchi_common.h  |  12 +-
 .../interface/vchiq_arm/vchiq_2835_arm.c  |  45 ++-
 .../interface/vchiq_arm/vchiq_arm.c   | 305 +++---
 .../interface/vchiq_arm/vchiq_arm.h   |  61 +--
 .../interface/vchiq_arm/vchiq_core.c  | 376 +-
 .../interface/vchiq_arm/vchiq_core.h  | 198 -
 .../interface/vchiq_arm/vchiq_debugfs.c   |   3 +-
 .../interface/vchiq_arm/vchiq_debugfs.h   |   4 +-
 .../interface/vchiq_arm/vchiq_if.h|  31 +-
 .../interface/vchiq_arm/vchiq_ioctl.h |  62 +--
 .../interface/vchiq_arm/vchiq_pagelist.h  |   4 +-
 .../interface/vchiq_arm/vchiq_shim.c  |  32 +-
 .../interface/vchiq_arm/vchiq_util.c  |  19 +-
 .../interface/vchiq_arm/vchiq_util.h  |  21 +-
 17 files changed, 634 insertions(+), 609 deletions(-)

-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 08/33] staging: vc04_services: Remove VCHI_MSG_VECTOR_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchi/vchi_common.h| 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h 
b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
index a5220621697b..35f331f80812 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
@@ -127,9 +127,9 @@ typedef void (*VCHI_CALLBACK_T)(void *callback_param, //my 
service local param
  * '-vec_len' elements. Thus to append a header onto an existing vector,
  * you can do this:
  *
- * void foo(const VCHI_MSG_VECTOR_T *v, int n)
+ * void foo(const struct vchi_msg_vector *v, int n)
  * {
- *VCHI_MSG_VECTOR_T nv[2];
+ *struct vchi_msg_vector nv[2];
  *nv[0].vec_base = my_header;
  *nv[0].vec_len = sizeof my_header;
  *nv[1].vec_base = v;
@@ -137,10 +137,10 @@ typedef void (*VCHI_CALLBACK_T)(void *callback_param, 
//my service local param
  *...
  *
  */
-typedef struct vchi_msg_vector {
+struct vchi_msg_vector {
const void *vec_base;
int32_t vec_len;
-} VCHI_MSG_VECTOR_T;
+};
 
 // Opaque type for a connection API
 typedef struct opaque_vchi_connection_api_t VCHI_CONNECTION_API_T;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 06/33] staging: vc04_services: Remove VCHI_HELD_MSG_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../vc04_services/bcm2835-camera/mmal-vchiq.c | 28 +--
 .../vc04_services/interface/vchi/vchi.h   | 20 ++---
 .../interface/vchiq_arm/vchiq_shim.c  |  8 +++---
 3 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
index c6d06f19fc6e..16af735af5c3 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
@@ -139,7 +139,7 @@ struct mmal_msg_context {
 
struct {
/* message handle to release */
-   VCHI_HELD_MSG_T msg_handle;
+   struct vchi_held_msg msg_handle;
/* pointer to received message */
struct mmal_msg *msg;
/* received message length */
@@ -527,7 +527,7 @@ static void service_callback(void *param,
int status;
u32 msg_len;
struct mmal_msg *msg;
-   VCHI_HELD_MSG_T msg_handle;
+   struct vchi_held_msg msg_handle;
struct mmal_msg_context *msg_context;
 
if (!instance) {
@@ -625,7 +625,7 @@ static int send_synchronous_mmal_msg(struct 
vchiq_mmal_instance *instance,
 struct mmal_msg *msg,
 unsigned int payload_len,
 struct mmal_msg **msg_out,
-VCHI_HELD_MSG_T *msg_handle_out)
+struct vchi_held_msg *msg_handle_out)
 {
struct mmal_msg_context *msg_context;
int ret;
@@ -751,7 +751,7 @@ static int port_info_set(struct vchiq_mmal_instance 
*instance,
int ret;
struct mmal_msg m;
struct mmal_msg *rmsg;
-   VCHI_HELD_MSG_T rmsg_handle;
+   struct vchi_held_msg rmsg_handle;
 
pr_debug("setting port info port %p\n", port);
if (!port)
@@ -812,7 +812,7 @@ static int port_info_get(struct vchiq_mmal_instance 
*instance,
int ret;
struct mmal_msg m;
struct mmal_msg *rmsg;
-   VCHI_HELD_MSG_T rmsg_handle;
+   struct vchi_held_msg rmsg_handle;
 
/* port info time */
m.h.type = MMAL_MSG_TYPE_PORT_INFO_GET;
@@ -908,7 +908,7 @@ static int create_component(struct vchiq_mmal_instance 
*instance,
int ret;
struct mmal_msg m;
struct mmal_msg *rmsg;
-   VCHI_HELD_MSG_T rmsg_handle;
+   struct vchi_held_msg rmsg_handle;
 
/* build component create message */
m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE;
@@ -955,7 +955,7 @@ static int destroy_component(struct vchiq_mmal_instance 
*instance,
int ret;
struct mmal_msg m;
struct mmal_msg *rmsg;
-   VCHI_HELD_MSG_T rmsg_handle;
+   struct vchi_held_msg rmsg_handle;
 
m.h.type = MMAL_MSG_TYPE_COMPONENT_DESTROY;
m.u.component_destroy.component_handle = component->handle;
@@ -988,7 +988,7 @@ static int enable_component(struct vchiq_mmal_instance 
*instance,
int ret;
struct mmal_msg m;
struct mmal_msg *rmsg;
-   VCHI_HELD_MSG_T rmsg_handle;
+   struct vchi_held_msg rmsg_handle;
 
m.h.type = MMAL_MSG_TYPE_COMPONENT_ENABLE;
m.u.component_enable.component_handle = component->handle;
@@ -1020,7 +1020,7 @@ static int disable_component(struct vchiq_mmal_instance 
*instance,
int ret;
struct mmal_msg m;
struct mmal_msg *rmsg;
-   VCHI_HELD_MSG_T rmsg_handle;
+   struct vchi_held_msg rmsg_handle;
 
m.h.type = MMAL_MSG_TYPE_COMPONENT_DISABLE;
m.u.component_disable.component_handle = component->handle;
@@ -1053,7 +1053,7 @@ static int get_version(struct vchiq_mmal_instance 
*instance,
int ret;
struct mmal_msg m;
struct mmal_msg *rmsg;
-   VCHI_HELD_MSG_T rmsg_handle;
+   struct vchi_held_msg rmsg_handle;
 
m.h.type = MMAL_MSG_TYPE_GET_VERSION;
 
@@ -1086,7 +1086,7 @@ static int port_action_port(struct vchiq_mmal_instance 
*instance,
int ret;
struct mmal_msg m;
struct mmal_msg *rmsg;
-   VCHI_HELD_MSG_T rmsg_handle;
+   struct vchi_held_msg rmsg_handle;
 
m.h.type = MMAL_MSG_TYPE_PORT_ACTION;
m.u.port_action_port.component_handle = port->component->handle;
@@ -1130,7 +1130,7 @@ static int port_action_handle(struct vchiq_mmal_instance 
*instance,
int ret;
struct mmal_msg m;
struct mmal_msg *rmsg;
-   VCHI_HELD_MSG_T rmsg_handle;
+   struct vchi_held_msg rmsg_handle;
 
m.h.type = MMAL_MSG_TYPE_PORT_ACTION;
 
@@ -1175,7 +1175,7 @@ static int port_parameter_set(struct vchiq_mmal_instance 
*instance,
int ret;
struct mmal_msg m;
struct m

[PATCH v2 05/33] staging: vc04_services: Remove USER_SERVICE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_arm.c   | 44 ++-
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index fa15033daf5f..50b874271cea 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -110,7 +110,7 @@ static const char *const resume_state_names[] = {
 
 static void suspend_timer_callback(struct timer_list *t);
 
-typedef struct user_service_struct {
+struct user_service {
VCHIQ_SERVICE_T *service;
void *userdata;
VCHIQ_INSTANCE_T instance;
@@ -124,7 +124,7 @@ typedef struct user_service_struct {
struct completion remove_event;
struct completion close_event;
VCHIQ_HEADER_T * msg_queue[MSG_QUEUE_SIZE];
-} USER_SERVICE_T;
+};
 
 struct bulk_waiter_node {
struct bulk_waiter bulk_waiter;
@@ -546,7 +546,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, 
void *data,
 
 static VCHIQ_STATUS_T
 add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason,
-   VCHIQ_HEADER_T *header, USER_SERVICE_T *user_service,
+   VCHIQ_HEADER_T *header, struct user_service *user_service,
void *bulk_userdata)
 {
VCHIQ_COMPLETION_DATA_T *completion;
@@ -616,11 +616,11 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T 
*header,
VCHIQ_SERVICE_HANDLE_T handle, void *bulk_userdata)
 {
/* How do we ensure the callback goes to the right client?
-   ** The service_user data points to a USER_SERVICE_T record containing
-   ** the original callback and the user state structure, which contains a
-   ** circular buffer for completion records.
+   ** The service_user data points to a user_service record
+   ** containing the original callback and the user state structure, which
+   ** contains a circular buffer for completion records.
*/
-   USER_SERVICE_T *user_service;
+   struct user_service *user_service;
VCHIQ_SERVICE_T *service;
VCHIQ_INSTANCE_T instance;
bool skip_completion = false;
@@ -631,7 +631,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T 
*header,
 
service = handle_to_service(handle);
BUG_ON(!service);
-   user_service = (USER_SERVICE_T *)service->base.userdata;
+   user_service = (struct user_service *)service->base.userdata;
instance = user_service->instance;
 
if (!instance || instance->closing)
@@ -735,7 +735,7 @@ user_service_free(void *userdata)
 *   close_delivered
 *
 ***/
-static void close_delivered(USER_SERVICE_T *user_service)
+static void close_delivered(struct user_service *user_service)
 {
vchiq_log_info(vchiq_arm_log_level,
"%s(handle=%x)",
@@ -899,7 +899,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
 
case VCHIQ_IOC_CREATE_SERVICE: {
VCHIQ_CREATE_SERVICE_T args;
-   USER_SERVICE_T *user_service = NULL;
+   struct user_service *user_service = NULL;
void *userdata;
int srvstate;
 
@@ -910,7 +910,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
break;
}
 
-   user_service = kmalloc(sizeof(USER_SERVICE_T), GFP_KERNEL);
+   user_service = kmalloc(sizeof(*user_service), GFP_KERNEL);
if (!user_service) {
ret = -ENOMEM;
break;
@@ -984,7 +984,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
case VCHIQ_IOC_CLOSE_SERVICE:
case VCHIQ_IOC_REMOVE_SERVICE: {
VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg;
-   USER_SERVICE_T *user_service;
+   struct user_service *user_service;
 
service = find_service_for_instance(instance, handle);
if (!service) {
@@ -1204,7 +1204,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
for (ret = 0; ret < args.count; ret++) {
VCHIQ_COMPLETION_DATA_T *completion;
VCHIQ_SERVICE_T *service;
-   USER_SERVICE_T *user_service;
+   struct user_service *user_service;
VCHIQ_HEADER_T *header;
 
if (remove == instance->completion_insert)
@@ -1320,7 +1320,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
 
case VCHIQ_IOC_DEQUEUE_MESSAGE: {
VCHIQ_DEQUEUE_MESS

[PATCH v2 07/33] staging: vc04_services: Remove VCHI_MSG_ITER_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 drivers/staging/vc04_services/interface/vchi/vchi.h  | 12 ++--
 .../vc04_services/interface/vchi/vchi_common.h   |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 71f61f242124..0b6fc0d31f4c 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -180,7 +180,7 @@ extern int32_t vchi_msg_hold(VCHI_SERVICE_HANDLE_T handle,
 
 // Initialise an iterator to look through messages in place
 extern int32_t vchi_msg_look_ahead(VCHI_SERVICE_HANDLE_T handle,
-  VCHI_MSG_ITER_T *iter,
+  struct vchi_msg_iter *iter,
   VCHI_FLAGS_T flags);
 
 /**
@@ -203,24 +203,24 @@ extern uint32_t vchi_held_msg_rx_timestamp(const struct 
vchi_held_msg *message);
 extern int32_t vchi_held_msg_release(struct vchi_held_msg *message);
 
 // Indicates whether the iterator has a next message.
-extern int32_t vchi_msg_iter_has_next(const VCHI_MSG_ITER_T *iter);
+extern int32_t vchi_msg_iter_has_next(const struct vchi_msg_iter *iter);
 
 // Return the pointer and length for the next message and advance the iterator.
-extern int32_t vchi_msg_iter_next(VCHI_MSG_ITER_T *iter,
+extern int32_t vchi_msg_iter_next(struct vchi_msg_iter *iter,
  void **data,
  uint32_t *msg_size);
 
 // Remove the last message returned by vchi_msg_iter_next.
 // Can only be called once after each call to vchi_msg_iter_next.
-extern int32_t vchi_msg_iter_remove(VCHI_MSG_ITER_T *iter);
+extern int32_t vchi_msg_iter_remove(struct vchi_msg_iter *iter);
 
 // Hold the last message returned by vchi_msg_iter_next.
 // Can only be called once after each call to vchi_msg_iter_next.
-extern int32_t vchi_msg_iter_hold(VCHI_MSG_ITER_T *iter,
+extern int32_t vchi_msg_iter_hold(struct vchi_msg_iter *iter,
  struct vchi_held_msg *message);
 
 // Return information for the next message, and hold it, advancing the 
iterator.
-extern int32_t vchi_msg_iter_hold_next(VCHI_MSG_ITER_T *iter,
+extern int32_t vchi_msg_iter_hold_next(struct vchi_msg_iter *iter,
   void **data,// } may be NULL
   uint32_t *msg_size, // }
   struct vchi_held_msg *message);
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h 
b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
index 8eb2bb9f0fe2..a5220621697b 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
@@ -154,11 +154,11 @@ typedef struct opaque_vchi_message_driver_t 
VCHI_MESSAGE_DRIVER_T;
 // will not proceed to messages received since. Behaviour is undefined if an 
iterator
 // is used again after messages for that service are removed/dequeued by any
 // means other than vchi_msg_iter_... calls on the iterator itself.
-typedef struct {
+struct vchi_msg_iter {
struct opaque_vchi_service_t *service;
void *last;
void *next;
void *remove;
-} VCHI_MSG_ITER_T;
+};
 
 #endif // VCHI_COMMON_H_
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 02/33] staging: vc04_services: Remove PAGELIST_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 +-
 .../vc04_services/interface/vchiq_arm/vchiq_pagelist.h |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index ecee54a31f8d..6eaaab8165bf 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -65,7 +65,7 @@ struct vchiq_2835_state {
 };
 
 struct vchiq_pagelist_info {
-   PAGELIST_T *pagelist;
+   struct pagelist *pagelist;
size_t pagelist_buffer_size;
dma_addr_t dma_addr;
enum dma_data_direction dma_dir;
@@ -384,7 +384,7 @@ cleanup_pagelistinfo(struct vchiq_pagelist_info 
*pagelistinfo)
 static struct vchiq_pagelist_info *
 create_pagelist(char __user *buf, size_t count, unsigned short type)
 {
-   PAGELIST_T *pagelist;
+   struct pagelist *pagelist;
struct vchiq_pagelist_info *pagelistinfo;
struct page **pages;
u32 *addrs;
@@ -398,7 +398,7 @@ create_pagelist(char __user *buf, size_t count, unsigned 
short type)
offset = ((unsigned int)(unsigned long)buf & (PAGE_SIZE - 1));
num_pages = DIV_ROUND_UP(count + offset, PAGE_SIZE);
 
-   pagelist_size = sizeof(PAGELIST_T) +
+   pagelist_size = sizeof(struct pagelist) +
(num_pages * sizeof(u32)) +
(num_pages * sizeof(pages[0]) +
(num_pages * sizeof(struct scatterlist))) +
@@ -566,8 +566,8 @@ static void
 free_pagelist(struct vchiq_pagelist_info *pagelistinfo,
  int actual)
 {
-   PAGELIST_T *pagelist   = pagelistinfo->pagelist;
-   struct page **pages= pagelistinfo->pages;
+   struct pagelist *pagelist = pagelistinfo->pagelist;
+   struct page **pages = pagelistinfo->pages;
unsigned int num_pages = pagelistinfo->num_pages;
 
vchiq_log_trace(vchiq_arm_log_level, "%s - %pK, %d",
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_pagelist.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_pagelist.h
index bec411061554..4eaf7398cf2e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_pagelist.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_pagelist.h
@@ -38,7 +38,7 @@
 #define PAGELIST_READ 1
 #define PAGELIST_READ_WITH_FRAGMENTS 2
 
-typedef struct pagelist_struct {
+struct pagelist {
u32 length;
u16 type;
u16 offset;
@@ -46,6 +46,6 @@ typedef struct pagelist_struct {
 * of following pages at consecutive
 * addresses.
 */
-} PAGELIST_T;
+};
 
 #endif /* VCHIQ_PAGELIST_H */
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 11/33] staging: vc04_services: Remove VCHIQ_BULK_QUEUE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../vc04_services/interface/vchiq_arm/vchiq_core.c  | 13 +++--
 .../vc04_services/interface/vchiq_arm/vchiq_core.h  |  8 
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 627ae8f7b082..8aff56ee6d4f 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -1202,8 +1202,8 @@ release_slot(VCHIQ_STATE_T *state, VCHIQ_SLOT_INFO_T 
*slot_info,
 
 /* Called by the slot handler - don't hold the bulk mutex */
 static VCHIQ_STATUS_T
-notify_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue,
-   int retry_poll)
+notify_bulks(VCHIQ_SERVICE_T *service, struct vchiq_bulk_queue *queue,
+int retry_poll)
 {
VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
 
@@ -1353,7 +1353,8 @@ poll_services(VCHIQ_STATE_T *state)
 
 /* Called with the bulk_mutex held */
 static void
-abort_outstanding_bulks(VCHIQ_SERVICE_T *service, VCHIQ_BULK_QUEUE_T *queue)
+abort_outstanding_bulks(VCHIQ_SERVICE_T *service,
+   struct vchiq_bulk_queue *queue)
 {
int is_tx = (queue == &service->bulk_tx);
 
@@ -1732,7 +1733,7 @@ parse_rx_slots(VCHIQ_STATE_T *state)
if ((service->remoteport == remoteport)
&& (service->srvstate !=
VCHIQ_SRVSTATE_FREE)) {
-   VCHIQ_BULK_QUEUE_T *queue;
+   struct vchiq_bulk_queue *queue;
VCHIQ_BULK_T *bulk;
 
queue = (type == VCHIQ_MSG_BULK_RX_DONE) ?
@@ -2089,7 +2090,7 @@ sync_func(void *v)
 }
 
 static void
-init_bulk_queue(VCHIQ_BULK_QUEUE_T *queue)
+init_bulk_queue(struct vchiq_bulk_queue *queue)
 {
queue->local_insert = 0;
queue->remote_insert = 0;
@@ -3017,7 +3018,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T 
handle,
   VCHIQ_BULK_DIR_T dir)
 {
VCHIQ_SERVICE_T *service = find_service_by_handle(handle);
-   VCHIQ_BULK_QUEUE_T *queue;
+   struct vchiq_bulk_queue *queue;
VCHIQ_BULK_T *bulk;
VCHIQ_STATE_T *state;
struct bulk_waiter *bulk_waiter = NULL;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index f4e950fe77ff..05b70c8a7239 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -250,7 +250,7 @@ typedef struct vchiq_bulk_struct {
int actual;
 } VCHIQ_BULK_T;
 
-typedef struct vchiq_bulk_queue_struct {
+struct vchiq_bulk_queue {
int local_insert;  /* Where to insert the next local bulk */
int remote_insert; /* Where to insert the next remote bulk (master) */
int process;   /* Bulk to transfer next */
@@ -258,7 +258,7 @@ typedef struct vchiq_bulk_queue_struct {
int remove;/* Bulk to notify the local client of, and remove,
   ** next */
VCHIQ_BULK_T bulks[VCHIQ_NUM_SERVICE_BULKS];
-} VCHIQ_BULK_QUEUE_T;
+};
 
 struct remote_event {
int armed;
@@ -304,8 +304,8 @@ typedef struct vchiq_service_struct {
 
int service_use_count;
 
-   VCHIQ_BULK_QUEUE_T bulk_tx;
-   VCHIQ_BULK_QUEUE_T bulk_rx;
+   struct vchiq_bulk_queue bulk_tx;
+   struct vchiq_bulk_queue bulk_rx;
 
struct completion remove_event;
struct completion bulk_remove_event;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 15/33] staging: vc04_services: Remove VCHIQ_CREATE_SERVICE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c   | 6 +++---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 05b513426671..c04779e08bab 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -898,7 +898,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
break;
 
case VCHIQ_IOC_CREATE_SERVICE: {
-   VCHIQ_CREATE_SERVICE_T args;
+   struct vchiq_create_service args;
struct user_service *user_service = NULL;
void *userdata;
int srvstate;
@@ -966,7 +966,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
}
 
if (copy_to_user((void __user *)
-   &(((VCHIQ_CREATE_SERVICE_T __user *)
+   &(((struct vchiq_create_service __user *)
arg)->handle),
(const void *)&service->handle,
sizeof(service->handle)) != 0) {
@@ -1532,7 +1532,7 @@ vchiq_compat_ioctl_create_service(
unsigned int cmd,
unsigned long arg)
 {
-   VCHIQ_CREATE_SERVICE_T __user *args;
+   struct vchiq_create_service __user *args;
struct vchiq_create_service32 __user *ptrargs32 =
(struct vchiq_create_service32 __user *)arg;
struct vchiq_create_service32 args32;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index 7c16f82392a4..89592ae90b8c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -40,12 +40,12 @@
 #define VCHIQ_IOC_MAGIC 0xc4
 #define VCHIQ_INVALID_HANDLE (~0)
 
-typedef struct {
+struct vchiq_create_service {
VCHIQ_SERVICE_PARAMS_T params;
int is_open;
int is_vchi;
unsigned int handle;   /* OUT */
-} VCHIQ_CREATE_SERVICE_T;
+};
 
 typedef struct {
unsigned int handle;
@@ -102,7 +102,7 @@ typedef struct {
 #define VCHIQ_IOC_CONNECT  _IO(VCHIQ_IOC_MAGIC,   0)
 #define VCHIQ_IOC_SHUTDOWN _IO(VCHIQ_IOC_MAGIC,   1)
 #define VCHIQ_IOC_CREATE_SERVICE \
-   _IOWR(VCHIQ_IOC_MAGIC, 2, VCHIQ_CREATE_SERVICE_T)
+   _IOWR(VCHIQ_IOC_MAGIC, 2, struct vchiq_create_service)
 #define VCHIQ_IOC_REMOVE_SERVICE   _IO(VCHIQ_IOC_MAGIC,   3)
 #define VCHIQ_IOC_QUEUE_MESSAGE \
_IOW(VCHIQ_IOC_MAGIC,  4, VCHIQ_QUEUE_MESSAGE_T)
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 10/33] staging: vc04_services: Remove VCHIQ_AWAIT_COMPLETION_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 
 .../vc04_services/interface/vchiq_arm/vchiq_ioctl.h   | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 57b6c3f0e7ef..16815763130e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1160,7 +1160,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
} break;
 
case VCHIQ_IOC_AWAIT_COMPLETION: {
-   VCHIQ_AWAIT_COMPLETION_T args;
+   struct vchiq_await_completion args;
 
DEBUG_TRACE(AWAIT_COMPLETION_LINE);
if (!instance->connected) {
@@ -1303,8 +1303,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
 
if (msgbufcount != args.msgbufcount) {
if (copy_to_user((void __user *)
-   &((VCHIQ_AWAIT_COMPLETION_T *)arg)->
-   msgbufcount,
+   &((struct vchiq_await_completion *)arg)
+   ->msgbufcount,
&msgbufcount,
sizeof(msgbufcount)) != 0) {
ret = -EFAULT;
@@ -1727,7 +1727,7 @@ vchiq_compat_ioctl_await_completion(struct file *file,
unsigned int cmd,
unsigned long arg)
 {
-   VCHIQ_AWAIT_COMPLETION_T __user *args;
+   struct vchiq_await_completion __user *args;
VCHIQ_COMPLETION_DATA_T __user *completion;
VCHIQ_COMPLETION_DATA_T completiontemp;
struct vchiq_await_completion32 args32;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index 858f46bd2ed7..37bef2652411 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -68,13 +68,13 @@ typedef struct {
void *bulk_userdata;
 } VCHIQ_COMPLETION_DATA_T;
 
-typedef struct {
+struct vchiq_await_completion {
unsigned int count;
VCHIQ_COMPLETION_DATA_T *buf;
unsigned int msgbufsize;
unsigned int msgbufcount; /* IN/OUT */
void **msgbufs;
-} VCHIQ_AWAIT_COMPLETION_T;
+};
 
 typedef struct {
unsigned int handle;
@@ -111,7 +111,7 @@ typedef struct {
 #define VCHIQ_IOC_QUEUE_BULK_RECEIVE \
_IOWR(VCHIQ_IOC_MAGIC, 6, VCHIQ_QUEUE_BULK_TRANSFER_T)
 #define VCHIQ_IOC_AWAIT_COMPLETION \
-   _IOWR(VCHIQ_IOC_MAGIC, 7, VCHIQ_AWAIT_COMPLETION_T)
+   _IOWR(VCHIQ_IOC_MAGIC, 7, struct vchiq_await_completion)
 #define VCHIQ_IOC_DEQUEUE_MESSAGE \
_IOWR(VCHIQ_IOC_MAGIC, 8, VCHIQ_DEQUEUE_MESSAGE_T)
 #define VCHIQ_IOC_GET_CLIENT_ID_IO(VCHIQ_IOC_MAGIC,   9)
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 14/33] staging: vc04_services: Remove VCHIQ_CONFIG_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c   | 2 +-
 .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c  | 2 +-
 .../staging/vc04_services/interface/vchiq_arm/vchiq_if.h| 6 +++---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 01beb990a023..05b513426671 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1410,7 +1410,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
 
case VCHIQ_IOC_GET_CONFIG: {
VCHIQ_GET_CONFIG_T args;
-   VCHIQ_CONFIG_T config;
+   struct vchiq_config config;
 
if (copy_from_user(&args, (const void __user *)arg,
sizeof(args)) != 0) {
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index bba82d381e73..d6f5aafb2712 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -3273,7 +3273,7 @@ vchiq_get_peer_version(VCHIQ_SERVICE_HANDLE_T handle, 
short *peer_version)
return status;
 }
 
-void vchiq_get_config(VCHIQ_CONFIG_T *config)
+void vchiq_get_config(struct vchiq_config *config)
 {
config->max_msg_size   = VCHIQ_MAX_MSG_SIZE;
config->bulk_threshold = VCHIQ_MAX_MSG_SIZE;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index 0cdaebee902d..0014715e0aca 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -110,7 +110,7 @@ typedef struct vchiq_service_params_struct {
short version_min;   /* Update for incompatible changes */
 } VCHIQ_SERVICE_PARAMS_T;
 
-typedef struct vchiq_config_struct {
+struct vchiq_config {
unsigned int max_msg_size;
unsigned int bulk_threshold; /* The message size above which it
is better to use a bulk transfer
@@ -119,7 +119,7 @@ typedef struct vchiq_config_struct {
unsigned int max_services;
short version;  /* The version of VCHIQ */
short version_min;  /* The minimum compatible version of VCHIQ */
-} VCHIQ_CONFIG_T;
+};
 
 typedef struct vchiq_instance_struct *VCHIQ_INSTANCE_T;
 typedef void (*VCHIQ_REMOTE_USE_CALLBACK_T)(void *cb_arg);
@@ -162,7 +162,7 @@ extern VCHIQ_STATUS_T 
vchiq_bulk_receive_handle(VCHIQ_SERVICE_HANDLE_T service,
 extern int   vchiq_get_client_id(VCHIQ_SERVICE_HANDLE_T service);
 extern void *vchiq_get_service_userdata(VCHIQ_SERVICE_HANDLE_T service);
 extern int   vchiq_get_service_fourcc(VCHIQ_SERVICE_HANDLE_T service);
-extern void vchiq_get_config(VCHIQ_CONFIG_T *config);
+extern void vchiq_get_config(struct vchiq_config *config);
 extern VCHIQ_STATUS_T vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T service,
VCHIQ_SERVICE_OPTION_T option, int value);
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index 251c82b9ea22..7c16f82392a4 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -85,7 +85,7 @@ typedef struct {
 
 typedef struct {
unsigned int config_size;
-   VCHIQ_CONFIG_T __user *pconfig;
+   struct vchiq_config __user *pconfig;
 } VCHIQ_GET_CONFIG_T;
 
 typedef struct {
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 28/33] staging: vc04_services: Remove VCHIQ_SHARED_STATE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_core.c  | 24 +--
 .../interface/vchiq_arm/vchiq_core.h  | 12 +-
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index d4935b208c78..5071d4e27acc 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -556,7 +556,7 @@ request_poll(VCHIQ_STATE_T *state, struct vchiq_service 
*service, int poll_type)
 static struct vchiq_header *
 reserve_space(VCHIQ_STATE_T *state, size_t space, int is_blocking)
 {
-   VCHIQ_SHARED_STATE_T *local = state->local;
+   struct vchiq_shared_state *local = state->local;
int tx_pos = state->local_tx_pos;
int slot_space = VCHIQ_SLOT_SIZE - (tx_pos & VCHIQ_SLOT_MASK);
 
@@ -617,7 +617,7 @@ reserve_space(VCHIQ_STATE_T *state, size_t space, int 
is_blocking)
 static void
 process_free_queue(VCHIQ_STATE_T *state, BITSET_T *service_found, size_t 
length)
 {
-   VCHIQ_SHARED_STATE_T *local = state->local;
+   struct vchiq_shared_state *local = state->local;
int slot_queue_available;
 
/* Find slots which have been freed by the other side, and return them
@@ -805,7 +805,7 @@ queue_message(VCHIQ_STATE_T *state, struct vchiq_service 
*service, int msgid,
   size_t offset, size_t maxsize),
  void *context, size_t size, int flags)
 {
-   VCHIQ_SHARED_STATE_T *local;
+   struct vchiq_shared_state *local;
struct vchiq_service_quota *service_quota = NULL;
struct vchiq_header *header;
int type = VCHIQ_MSG_TYPE(msgid);
@@ -1053,7 +1053,7 @@ queue_message_sync(VCHIQ_STATE_T *state, struct 
vchiq_service *service,
size_t offset, size_t maxsize),
   void *context, int size, int is_blocking)
 {
-   VCHIQ_SHARED_STATE_T *local;
+   struct vchiq_shared_state *local;
struct vchiq_header *header;
ssize_t callback_result;
 
@@ -1524,7 +1524,7 @@ parse_open(VCHIQ_STATE_T *state, struct vchiq_header 
*header)
 static void
 parse_rx_slots(VCHIQ_STATE_T *state)
 {
-   VCHIQ_SHARED_STATE_T *remote = state->remote;
+   struct vchiq_shared_state *remote = state->remote;
struct vchiq_service *service = NULL;
int tx_pos;
 
@@ -1876,7 +1876,7 @@ static int
 slot_handler_func(void *v)
 {
VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v;
-   VCHIQ_SHARED_STATE_T *local = state->local;
+   struct vchiq_shared_state *local = state->local;
 
DEBUG_INITIALISE(local)
 
@@ -1960,7 +1960,7 @@ static int
 recycle_func(void *v)
 {
VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v;
-   VCHIQ_SHARED_STATE_T *local = state->local;
+   struct vchiq_shared_state *local = state->local;
BITSET_T *found;
size_t length;
 
@@ -1984,7 +1984,7 @@ static int
 sync_func(void *v)
 {
VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v;
-   VCHIQ_SHARED_STATE_T *local = state->local;
+   struct vchiq_shared_state *local = state->local;
struct vchiq_header *header =
(struct vchiq_header *)SLOT_DATA_FROM_INDEX(state,
state->remote->slot_sync);
@@ -2146,8 +2146,8 @@ vchiq_init_slots(void *mem_base, int mem_size)
 VCHIQ_STATUS_T
 vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero)
 {
-   VCHIQ_SHARED_STATE_T *local;
-   VCHIQ_SHARED_STATE_T *remote;
+   struct vchiq_shared_state *local;
+   struct vchiq_shared_state *remote;
VCHIQ_STATUS_T status;
char threadname[16];
int i;
@@ -3218,7 +3218,7 @@ vchiq_release_message(VCHIQ_SERVICE_HANDLE_T handle,
  struct vchiq_header *header)
 {
struct vchiq_service *service = find_service_by_handle(handle);
-   VCHIQ_SHARED_STATE_T *remote;
+   struct vchiq_shared_state *remote;
VCHIQ_STATE_T *state;
int slot_index;
 
@@ -3361,7 +3361,7 @@ vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T handle,
 
 static void
 vchiq_dump_shared_state(void *dump_context, VCHIQ_STATE_T *state,
-   VCHIQ_SHARED_STATE_T *shared, const char *label)
+   struct vchiq_shared_state *shared, const char *label)
 {
static const char *const debug_names[] = {
"",
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index be81b40f51d2..95b1bd18809c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -341,7 +341,7 @@ struct vchiq_service_quota {
int previous_tx_index;

[PATCH v2 21/33] staging: vc04_services: Remove VCHIQ_QUEUE_BULK_TRANSFER_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 6 +++---
 .../vc04_services/interface/vchiq_arm/vchiq_ioctl.h   | 8 
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 98a303e7b6eb..2df308b6a675 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1071,7 +1071,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
 
case VCHIQ_IOC_QUEUE_BULK_TRANSMIT:
case VCHIQ_IOC_QUEUE_BULK_RECEIVE: {
-   VCHIQ_QUEUE_BULK_TRANSFER_T args;
+   struct vchiq_queue_bulk_transfer args;
struct bulk_waiter_node *waiter = NULL;
 
VCHIQ_BULK_DIR_T dir =
@@ -1151,7 +1151,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
waiter, current->pid);
 
if (copy_to_user((void __user *)
-   &(((VCHIQ_QUEUE_BULK_TRANSFER_T __user *)
+   &(((struct vchiq_queue_bulk_transfer __user *)
arg)->mode),
(const void *)&mode_waiting,
sizeof(mode_waiting)) != 0)
@@ -1662,7 +1662,7 @@ vchiq_compat_ioctl_queue_bulk(struct file *file,
  unsigned int cmd,
  unsigned long arg)
 {
-   VCHIQ_QUEUE_BULK_TRANSFER_T __user *args;
+   struct vchiq_queue_bulk_transfer __user *args;
struct vchiq_queue_bulk_transfer32 args32;
struct vchiq_queue_bulk_transfer32 *ptrargs32 =
(struct vchiq_queue_bulk_transfer32 *)arg;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index 976f230158ad..284ce4faa384 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -53,13 +53,13 @@ typedef struct {
const struct vchiq_element __user *elements;
 } VCHIQ_QUEUE_MESSAGE_T;
 
-typedef struct {
+struct vchiq_queue_bulk_transfer {
unsigned int handle;
void *data;
unsigned int size;
void *userdata;
VCHIQ_BULK_MODE_T mode;
-} VCHIQ_QUEUE_BULK_TRANSFER_T;
+};
 
 struct vchiq_completion_data {
VCHIQ_REASON_T reason;
@@ -107,9 +107,9 @@ struct vchiq_dump_mem {
 #define VCHIQ_IOC_QUEUE_MESSAGE \
_IOW(VCHIQ_IOC_MAGIC,  4, VCHIQ_QUEUE_MESSAGE_T)
 #define VCHIQ_IOC_QUEUE_BULK_TRANSMIT \
-   _IOWR(VCHIQ_IOC_MAGIC, 5, VCHIQ_QUEUE_BULK_TRANSFER_T)
+   _IOWR(VCHIQ_IOC_MAGIC, 5, struct vchiq_queue_bulk_transfer)
 #define VCHIQ_IOC_QUEUE_BULK_RECEIVE \
-   _IOWR(VCHIQ_IOC_MAGIC, 6, VCHIQ_QUEUE_BULK_TRANSFER_T)
+   _IOWR(VCHIQ_IOC_MAGIC, 6, struct vchiq_queue_bulk_transfer)
 #define VCHIQ_IOC_AWAIT_COMPLETION \
_IOWR(VCHIQ_IOC_MAGIC, 7, struct vchiq_await_completion)
 #define VCHIQ_IOC_DEQUEUE_MESSAGE \
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 16/33] staging: vc04_services: Remove VCHIQ_DEBUGFS_NODE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 ++--
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h | 2 +-
 .../staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c | 3 ++-
 .../staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.h | 4 ++--
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index c04779e08bab..d84734f265b5 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -151,7 +151,7 @@ struct vchiq_instance_struct {
struct list_head bulk_waiter_list;
struct mutex bulk_waiter_list_mutex;
 
-   VCHIQ_DEBUGFS_NODE_T debugfs_node;
+   struct vchiq_debugfs_node debugfs_node;
 };
 
 struct dump_context {
@@ -3215,7 +3215,7 @@ vchiq_release_service_internal(VCHIQ_SERVICE_T *service)
return vchiq_release_internal(service->state, service);
 }
 
-VCHIQ_DEBUGFS_NODE_T *
+struct vchiq_debugfs_node *
 vchiq_instance_get_debugfs_node(VCHIQ_INSTANCE_T instance)
 {
return &instance->debugfs_node;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
index 377e283dac61..5a62ef79c78b 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
@@ -192,7 +192,7 @@ vchiq_use_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T 
*service,
 extern VCHIQ_STATUS_T
 vchiq_release_internal(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service);
 
-extern VCHIQ_DEBUGFS_NODE_T *
+extern struct vchiq_debugfs_node *
 vchiq_instance_get_debugfs_node(VCHIQ_INSTANCE_T instance);
 
 extern int
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
index 6a9e71a61142..94786a9e8796 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
@@ -243,7 +243,8 @@ void vchiq_debugfs_add_instance(VCHIQ_INSTANCE_T instance)
 
 void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance)
 {
-   VCHIQ_DEBUGFS_NODE_T *node = vchiq_instance_get_debugfs_node(instance);
+   struct vchiq_debugfs_node *node =
+   vchiq_instance_get_debugfs_node(instance);
 
debugfs_remove_recursive(node->dentry);
 }
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.h
index 3af6397ada19..5be1a5663f51 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.h
@@ -36,9 +36,9 @@
 
 #include "vchiq_core.h"
 
-typedef struct vchiq_debugfs_node_struct {
+struct vchiq_debugfs_node {
 struct dentry *dentry;
-} VCHIQ_DEBUGFS_NODE_T;
+};
 
 void vchiq_debugfs_init(void);
 
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 20/33] staging: vc04_services: Remove VCHIQ_HEADER_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_arm.c   | 20 +++---
 .../interface/vchiq_arm/vchiq_core.c  | 66 ++-
 .../interface/vchiq_arm/vchiq_if.h| 13 ++--
 .../interface/vchiq_arm/vchiq_ioctl.h |  2 +-
 .../interface/vchiq_arm/vchiq_shim.c  | 14 ++--
 .../interface/vchiq_arm/vchiq_util.c  | 11 ++--
 .../interface/vchiq_arm/vchiq_util.h  |  8 +--
 7 files changed, 71 insertions(+), 63 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 0d2fbee00cd2..98a303e7b6eb 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -123,7 +123,7 @@ struct user_service {
struct completion insert_event;
struct completion remove_event;
struct completion close_event;
-   VCHIQ_HEADER_T * msg_queue[MSG_QUEUE_SIZE];
+   struct vchiq_header *msg_queue[MSG_QUEUE_SIZE];
 };
 
 struct bulk_waiter_node {
@@ -546,8 +546,8 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, 
void *data,
 
 static VCHIQ_STATUS_T
 add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason,
-   VCHIQ_HEADER_T *header, struct user_service *user_service,
-   void *bulk_userdata)
+  struct vchiq_header *header, struct user_service *user_service,
+  void *bulk_userdata)
 {
struct vchiq_completion_data *completion;
int insert;
@@ -612,8 +612,8 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T 
reason,
 ***/
 
 static VCHIQ_STATUS_T
-service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header,
-   VCHIQ_SERVICE_HANDLE_T handle, void *bulk_userdata)
+service_callback(VCHIQ_REASON_T reason, struct vchiq_header *header,
+VCHIQ_SERVICE_HANDLE_T handle, void *bulk_userdata)
 {
/* How do we ensure the callback goes to the right client?
** The service_user data points to a user_service record
@@ -1205,7 +1205,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
struct vchiq_completion_data *completion;
VCHIQ_SERVICE_T *service;
struct user_service *user_service;
-   VCHIQ_HEADER_T *header;
+   struct vchiq_header *header;
 
if (remove == instance->completion_insert)
break;
@@ -1230,7 +1230,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
int msglen;
 
msglen = header->size +
-   sizeof(VCHIQ_HEADER_T);
+   sizeof(struct vchiq_header);
/* This must be a VCHIQ-style service */
if (args.msgbufsize < msglen) {
vchiq_log_error(
@@ -1322,7 +1322,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
case VCHIQ_IOC_DEQUEUE_MESSAGE: {
struct vchiq_dequeue_message args;
struct user_service *user_service;
-   VCHIQ_HEADER_T *header;
+   struct vchiq_header *header;
 
DEBUG_TRACE(DEQUEUE_MESSAGE_LINE);
if (copy_from_user
@@ -2043,7 +2043,7 @@ static int vchiq_release(struct inode *inode, struct file 
*file)
spin_lock(&msg_queue_spinlock);
 
while (user_service->msg_remove != user_service->msg_insert) {
-   VCHIQ_HEADER_T *header;
+   struct vchiq_header *header;
int m = user_service->msg_remove & (MSG_QUEUE_SIZE - 1);
 
header = user_service->msg_queue[m];
@@ -2311,7 +2311,7 @@ vchiq_videocore_wanted(VCHIQ_STATE_T *state)
 
 static VCHIQ_STATUS_T
 vchiq_keepalive_vchiq_callback(VCHIQ_REASON_T reason,
-   VCHIQ_HEADER_T *header,
+   struct vchiq_header *header,
VCHIQ_SERVICE_HANDLE_T service_user,
void *bulk_user)
 {
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index d6f5aafb2712..e5549d540cad 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -73,8 +73,8 @@ enum {
 };
 
 /* we require this for consistency between endpoints */
-vchiq_static_assert(sizeof(VCHIQ_HEADER_T) == 8);
-vchiq_static_as

[PATCH v2 19/33] staging: vc04_services: Remove VCHIQ_GET_CONFIG_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c   | 4 ++--
 .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index c5c266dfa875..0d2fbee00cd2 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1409,7 +1409,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
} break;
 
case VCHIQ_IOC_GET_CONFIG: {
-   VCHIQ_GET_CONFIG_T args;
+   struct vchiq_get_config args;
struct vchiq_config config;
 
if (copy_from_user(&args, (const void __user *)arg,
@@ -1913,7 +1913,7 @@ vchiq_compat_ioctl_get_config(struct file *file,
  unsigned int cmd,
  unsigned long arg)
 {
-   VCHIQ_GET_CONFIG_T __user *args;
+   struct vchiq_get_config __user *args;
struct vchiq_get_config32 args32;
 
args = compat_alloc_user_space(sizeof(*args));
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index f4d8bd2b3c6b..6de2dd3c37d1 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -83,10 +83,10 @@ struct vchiq_dequeue_message {
void *buf;
 };
 
-typedef struct {
+struct vchiq_get_config {
unsigned int config_size;
struct vchiq_config __user *pconfig;
-} VCHIQ_GET_CONFIG_T;
+};
 
 typedef struct {
unsigned int handle;
@@ -116,7 +116,7 @@ struct vchiq_dump_mem {
_IOWR(VCHIQ_IOC_MAGIC, 8, struct vchiq_dequeue_message)
 #define VCHIQ_IOC_GET_CLIENT_ID_IO(VCHIQ_IOC_MAGIC,   9)
 #define VCHIQ_IOC_GET_CONFIG \
-   _IOWR(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T)
+   _IOWR(VCHIQ_IOC_MAGIC, 10, struct vchiq_get_config)
 #define VCHIQ_IOC_CLOSE_SERVICE_IO(VCHIQ_IOC_MAGIC,   11)
 #define VCHIQ_IOC_USE_SERVICE  _IO(VCHIQ_IOC_MAGIC,   12)
 #define VCHIQ_IOC_RELEASE_SERVICE  _IO(VCHIQ_IOC_MAGIC,   13)
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 17/33] staging: vc04_services: Remove VCHIQ_DEQUEUE_MESSAGE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c   | 4 ++--
 .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index d84734f265b5..c5c266dfa875 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1320,7 +1320,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
} break;
 
case VCHIQ_IOC_DEQUEUE_MESSAGE: {
-   VCHIQ_DEQUEUE_MESSAGE_T args;
+   struct vchiq_dequeue_message args;
struct user_service *user_service;
VCHIQ_HEADER_T *header;
 
@@ -1878,7 +1878,7 @@ vchiq_compat_ioctl_dequeue_message(struct file *file,
   unsigned int cmd,
   unsigned long arg)
 {
-   VCHIQ_DEQUEUE_MESSAGE_T __user *args;
+   struct vchiq_dequeue_message __user *args;
struct vchiq_dequeue_message32 args32;
 
args = compat_alloc_user_space(sizeof(*args));
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index 89592ae90b8c..aaf825f7a0f7 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -76,12 +76,12 @@ struct vchiq_await_completion {
void **msgbufs;
 };
 
-typedef struct {
+struct vchiq_dequeue_message {
unsigned int handle;
int blocking;
unsigned int bufsize;
void *buf;
-} VCHIQ_DEQUEUE_MESSAGE_T;
+};
 
 typedef struct {
unsigned int config_size;
@@ -113,7 +113,7 @@ typedef struct {
 #define VCHIQ_IOC_AWAIT_COMPLETION \
_IOWR(VCHIQ_IOC_MAGIC, 7, struct vchiq_await_completion)
 #define VCHIQ_IOC_DEQUEUE_MESSAGE \
-   _IOWR(VCHIQ_IOC_MAGIC, 8, VCHIQ_DEQUEUE_MESSAGE_T)
+   _IOWR(VCHIQ_IOC_MAGIC, 8, struct vchiq_dequeue_message)
 #define VCHIQ_IOC_GET_CLIENT_ID_IO(VCHIQ_IOC_MAGIC,   9)
 #define VCHIQ_IOC_GET_CONFIG \
_IOWR(VCHIQ_IOC_MAGIC, 10, VCHIQ_GET_CONFIG_T)
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 31/33] staging: vc04_services: Remove VCHIQ_SLOT_ZERO_T

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_2835_arm.c   |  2 +-
 .../vc04_services/interface/vchiq_arm/vchiq_core.c | 14 +++---
 .../vc04_services/interface/vchiq_arm/vchiq_core.h | 10 +-
 3 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 6fa965ead636..7925fe8f5261 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -111,7 +111,7 @@ int vchiq_platform_init(struct platform_device *pdev, 
VCHIQ_STATE_T *state)
struct device *dev = &pdev->dev;
struct vchiq_drvdata *drvdata = platform_get_drvdata(pdev);
struct rpi_firmware *fw = drvdata->fw;
-   VCHIQ_SLOT_ZERO_T *vchiq_slot_zero;
+   struct vchiq_slot_zero *vchiq_slot_zero;
struct resource *res;
void *slot_mem;
dma_addr_t slot_phys;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index d92245bcebaf..f8cd5e34d702 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -1712,7 +1712,7 @@ parse_rx_slots(VCHIQ_STATE_T *state)
case VCHIQ_MSG_CONNECT:
vchiq_log_info(vchiq_core_log_level,
"%d: prs CONNECT@%pK", state->id, header);
-   state->version_common = ((VCHIQ_SLOT_ZERO_T *)
+   state->version_common = ((struct vchiq_slot_zero *)
 state->slot_data)->version;
complete(&state->connect);
break;
@@ -2103,13 +2103,13 @@ get_conn_state_name(VCHIQ_CONNSTATE_T conn_state)
return conn_state_names[conn_state];
 }
 
-VCHIQ_SLOT_ZERO_T *
+struct vchiq_slot_zero *
 vchiq_init_slots(void *mem_base, int mem_size)
 {
int mem_align =
(int)((VCHIQ_SLOT_SIZE - (long)mem_base) & VCHIQ_SLOT_MASK);
-   VCHIQ_SLOT_ZERO_T *slot_zero =
-   (VCHIQ_SLOT_ZERO_T *)((char *)mem_base + mem_align);
+   struct vchiq_slot_zero *slot_zero =
+   (struct vchiq_slot_zero *)((char *)mem_base + mem_align);
int num_slots = (mem_size - mem_align)/VCHIQ_SLOT_SIZE;
int first_data_slot = VCHIQ_SLOT_ZERO_SLOTS;
 
@@ -2123,12 +2123,12 @@ vchiq_init_slots(void *mem_base, int mem_size)
return NULL;
}
 
-   memset(slot_zero, 0, sizeof(VCHIQ_SLOT_ZERO_T));
+   memset(slot_zero, 0, sizeof(struct vchiq_slot_zero));
 
slot_zero->magic = VCHIQ_MAGIC;
slot_zero->version = VCHIQ_VERSION;
slot_zero->version_min = VCHIQ_VERSION_MIN;
-   slot_zero->slot_zero_size = sizeof(VCHIQ_SLOT_ZERO_T);
+   slot_zero->slot_zero_size = sizeof(struct vchiq_slot_zero);
slot_zero->slot_size = VCHIQ_SLOT_SIZE;
slot_zero->max_slots = VCHIQ_MAX_SLOTS;
slot_zero->max_slots_per_side = VCHIQ_MAX_SLOTS_PER_SIDE;
@@ -2144,7 +2144,7 @@ vchiq_init_slots(void *mem_base, int mem_size)
 }
 
 VCHIQ_STATUS_T
-vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero)
+vchiq_init_state(VCHIQ_STATE_T *state, struct vchiq_slot_zero *slot_zero)
 {
struct vchiq_shared_state *local;
struct vchiq_shared_state *remote;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 0cdd66312b78..c319312013f7 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -90,7 +90,7 @@ vchiq_static_assert(IS_POW2(VCHIQ_MAX_SLOTS_PER_SIDE));
 
 #define VCHIQ_SLOT_MASK(VCHIQ_SLOT_SIZE - 1)
 #define VCHIQ_SLOT_QUEUE_MASK  (VCHIQ_MAX_SLOTS_PER_SIDE - 1)
-#define VCHIQ_SLOT_ZERO_SLOTS  ((sizeof(VCHIQ_SLOT_ZERO_T) + \
+#define VCHIQ_SLOT_ZERO_SLOTS  ((sizeof(struct vchiq_slot_zero) + \
VCHIQ_SLOT_SIZE - 1) / VCHIQ_SLOT_SIZE)
 
 #define VCHIQ_MSG_PADDING0  /* - */
@@ -382,7 +382,7 @@ struct vchiq_shared_state {
int debug[DEBUG_MAX];
 };
 
-typedef struct vchiq_slot_zero_struct {
+struct vchiq_slot_zero {
int magic;
short version;
short version_min;
@@ -394,7 +394,7 @@ typedef struct vchiq_slot_zero_struct {
struct vchiq_shared_state master;
struct vchiq_shared_state slave;
struct vchiq_slot_info slots[VCHIQ_MAX_SLOTS];
-} VCHIQ_SLOT_ZERO_T;
+};
 
 struct vchiq_state_struct {
int id;
@@ -520,11 +520,11 @@ extern VCHIQ_STATE_T *vchiq_states[VCHIQ_MAX_STATES];
 ext

[PATCH v2 33/33] staging: vc04_services: Remove VCHIU_QUEUE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_shim.c  |  2 +-
 .../interface/vchiq_arm/vchiq_util.c  | 14 +++---
 .../interface/vchiq_arm/vchiq_util.h  | 19 ++-
 3 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 0a4e379da03e..ab6ca8fd6f14 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -44,7 +44,7 @@
 struct shim_service {
VCHIQ_SERVICE_HANDLE_T handle;
 
-   VCHIU_QUEUE_T queue;
+   struct vchiu_queue queue;
 
VCHI_CALLBACK_T callback;
void *callback_param;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c
index 61381a6c256e..a5db1c39bd2d 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.c
@@ -39,7 +39,7 @@ static inline int is_pow2(int i)
return i && !(i & (i - 1));
 }
 
-int vchiu_queue_init(VCHIU_QUEUE_T *queue, int size)
+int vchiu_queue_init(struct vchiu_queue *queue, int size)
 {
WARN_ON(!is_pow2(size));
 
@@ -60,22 +60,22 @@ int vchiu_queue_init(VCHIU_QUEUE_T *queue, int size)
return 1;
 }
 
-void vchiu_queue_delete(VCHIU_QUEUE_T *queue)
+void vchiu_queue_delete(struct vchiu_queue *queue)
 {
kfree(queue->storage);
 }
 
-int vchiu_queue_is_empty(VCHIU_QUEUE_T *queue)
+int vchiu_queue_is_empty(struct vchiu_queue *queue)
 {
return queue->read == queue->write;
 }
 
-int vchiu_queue_is_full(VCHIU_QUEUE_T *queue)
+int vchiu_queue_is_full(struct vchiu_queue *queue)
 {
return queue->write == queue->read + queue->size;
 }
 
-void vchiu_queue_push(VCHIU_QUEUE_T *queue, struct vchiq_header *header)
+void vchiu_queue_push(struct vchiu_queue *queue, struct vchiq_header *header)
 {
if (!queue->initialized)
return;
@@ -91,7 +91,7 @@ void vchiu_queue_push(VCHIU_QUEUE_T *queue, struct 
vchiq_header *header)
complete(&queue->push);
 }
 
-struct vchiq_header *vchiu_queue_peek(VCHIU_QUEUE_T *queue)
+struct vchiq_header *vchiu_queue_peek(struct vchiu_queue *queue)
 {
while (queue->write == queue->read) {
if (wait_for_completion_interruptible(&queue->push))
@@ -103,7 +103,7 @@ struct vchiq_header *vchiu_queue_peek(VCHIU_QUEUE_T *queue)
return queue->storage[queue->read & (queue->size - 1)];
 }
 
-struct vchiq_header *vchiu_queue_pop(VCHIU_QUEUE_T *queue)
+struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue)
 {
struct vchiq_header *header;
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h
index ba8d5f778426..d842194b4023 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_util.h
@@ -54,7 +54,7 @@
 
 #include "vchiq_if.h"
 
-typedef struct {
+struct vchiu_queue {
int size;
int read;
int write;
@@ -64,17 +64,18 @@ typedef struct {
struct completion push;
 
struct vchiq_header **storage;
-} VCHIU_QUEUE_T;
+};
 
-extern int  vchiu_queue_init(VCHIU_QUEUE_T *queue, int size);
-extern void vchiu_queue_delete(VCHIU_QUEUE_T *queue);
+extern int  vchiu_queue_init(struct vchiu_queue *queue, int size);
+extern void vchiu_queue_delete(struct vchiu_queue *queue);
 
-extern int vchiu_queue_is_empty(VCHIU_QUEUE_T *queue);
-extern int vchiu_queue_is_full(VCHIU_QUEUE_T *queue);
+extern int vchiu_queue_is_empty(struct vchiu_queue *queue);
+extern int vchiu_queue_is_full(struct vchiu_queue *queue);
 
-extern void vchiu_queue_push(VCHIU_QUEUE_T *queue, struct vchiq_header 
*header);
+extern void vchiu_queue_push(struct vchiu_queue *queue,
+struct vchiq_header *header);
 
-extern struct vchiq_header *vchiu_queue_peek(VCHIU_QUEUE_T *queue);
-extern struct vchiq_header *vchiu_queue_pop(VCHIU_QUEUE_T *queue);
+extern struct vchiq_header *vchiu_queue_peek(struct vchiu_queue *queue);
+extern struct vchiq_header *vchiu_queue_pop(struct vchiu_queue *queue);
 
 #endif
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 26/33] staging: vc04_services: Remove VCHIQ_SERVICE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_arm.c   |  51 +++
 .../interface/vchiq_arm/vchiq_arm.h   |   8 +-
 .../interface/vchiq_arm/vchiq_core.c  | 137 +-
 .../interface/vchiq_arm/vchiq_core.h  |  51 +++
 4 files changed, 122 insertions(+), 125 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index f997bf69d03b..fae0ab61ceee 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -111,7 +111,7 @@ static const char *const resume_state_names[] = {
 static void suspend_timer_callback(struct timer_list *t);
 
 struct user_service {
-   VCHIQ_SERVICE_T *service;
+   struct vchiq_service *service;
void *userdata;
VCHIQ_INSTANCE_T instance;
char is_vchi;
@@ -337,7 +337,7 @@ VCHIQ_STATUS_T vchiq_add_service(
 {
VCHIQ_STATUS_T status;
VCHIQ_STATE_T *state = instance->state;
-   VCHIQ_SERVICE_T *service = NULL;
+   struct vchiq_service *service = NULL;
int srvstate;
 
vchiq_log_trace(vchiq_core_log_level,
@@ -376,7 +376,7 @@ VCHIQ_STATUS_T vchiq_open_service(
 {
VCHIQ_STATUS_T   status = VCHIQ_ERROR;
VCHIQ_STATE_T   *state = instance->state;
-   VCHIQ_SERVICE_T *service = NULL;
+   struct vchiq_service *service = NULL;
 
vchiq_log_trace(vchiq_core_log_level,
"%s(%p) called", __func__, instance);
@@ -463,7 +463,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, 
void *data,
unsigned int size, VCHIQ_BULK_DIR_T dir)
 {
VCHIQ_INSTANCE_T instance;
-   VCHIQ_SERVICE_T *service;
+   struct vchiq_service *service;
VCHIQ_STATUS_T status;
struct bulk_waiter_node *waiter = NULL;
 
@@ -621,7 +621,7 @@ service_callback(VCHIQ_REASON_T reason, struct vchiq_header 
*header,
** contains a circular buffer for completion records.
*/
struct user_service *user_service;
-   VCHIQ_SERVICE_T *service;
+   struct vchiq_service *service;
VCHIQ_INSTANCE_T instance;
bool skip_completion = false;
 
@@ -836,7 +836,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
 {
VCHIQ_INSTANCE_T instance = file->private_data;
VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
-   VCHIQ_SERVICE_T *service = NULL;
+   struct vchiq_service *service = NULL;
long ret = 0;
int i, rc;
 
@@ -1203,7 +1203,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
 
for (ret = 0; ret < args.count; ret++) {
struct vchiq_completion_data *completion;
-   VCHIQ_SERVICE_T *service;
+   struct vchiq_service *service;
struct user_service *user_service;
struct vchiq_header *header;
 
@@ -1993,7 +1993,7 @@ static int vchiq_release(struct inode *inode, struct file 
*file)
 {
VCHIQ_INSTANCE_T instance = file->private_data;
VCHIQ_STATE_T *state = vchiq_get_state();
-   VCHIQ_SERVICE_T *service;
+   struct vchiq_service *service;
int ret = 0;
int i;
 
@@ -2064,7 +2064,7 @@ static int vchiq_release(struct inode *inode, struct file 
*file)
while (instance->completion_remove !=
instance->completion_insert) {
struct vchiq_completion_data *completion;
-   VCHIQ_SERVICE_T *service;
+   struct vchiq_service *service;
 
completion = &instance->completions[
instance->completion_remove & (MAX_COMPLETIONS - 1)];
@@ -2169,7 +2169,7 @@ vchiq_dump_platform_instances(void *dump_context)
marking those that have been dumped. */
 
for (i = 0; i < state->unused_service; i++) {
-   VCHIQ_SERVICE_T *service = state->services[i];
+   struct vchiq_service *service = state->services[i];
VCHIQ_INSTANCE_T instance;
 
if (service && (service->base.callback == service_callback)) {
@@ -2180,7 +2180,7 @@ vchiq_dump_platform_instances(void *dump_context)
}
 
for (i = 0; i < state->unused_service; i++) {
-   VCHIQ_SERVICE_T *service = state->services[i];
+   struct vchiq_service *service = state->services[i];
VCHIQ_INSTANCE_T instance;
 
if (service && (service->base.callback == service_callback)) {
@@ -2210,7 +2210,8 @@ vchiq_dump_platform_instances(void *dump_context)
 ***/
 
 void
-vchiq_dump_platform_service_state(void *dump_context, VCHIQ

[PATCH v2 32/33] staging: vc04_services: Remove VCHIQ_STATE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_2835_arm.c  | 22 ++---
 .../interface/vchiq_arm/vchiq_arm.c   | 64 +++--
 .../interface/vchiq_arm/vchiq_arm.h   | 39 
 .../interface/vchiq_arm/vchiq_core.c  | 94 ++-
 .../interface/vchiq_arm/vchiq_core.h  | 70 +++---
 5 files changed, 149 insertions(+), 140 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 7925fe8f5261..8a8080fa1215 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -106,7 +106,7 @@ static void
 free_pagelist(struct vchiq_pagelist_info *pagelistinfo,
  int actual);
 
-int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state)
+int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state 
*state)
 {
struct device *dev = &pdev->dev;
struct vchiq_drvdata *drvdata = platform_get_drvdata(pdev);
@@ -204,7 +204,7 @@ int vchiq_platform_init(struct platform_device *pdev, 
VCHIQ_STATE_T *state)
 }
 
 VCHIQ_STATUS_T
-vchiq_platform_init_state(VCHIQ_STATE_T *state)
+vchiq_platform_init_state(struct vchiq_state *state)
 {
VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
struct vchiq_2835_state *platform_state;
@@ -222,7 +222,7 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state)
 }
 
 struct vchiq_arm_state*
-vchiq_platform_get_arm_state(VCHIQ_STATE_T *state)
+vchiq_platform_get_arm_state(struct vchiq_state *state)
 {
struct vchiq_2835_state *platform_state;
 
@@ -291,29 +291,29 @@ vchiq_dump_platform_state(void *dump_context)
 }
 
 VCHIQ_STATUS_T
-vchiq_platform_suspend(VCHIQ_STATE_T *state)
+vchiq_platform_suspend(struct vchiq_state *state)
 {
return VCHIQ_ERROR;
 }
 
 VCHIQ_STATUS_T
-vchiq_platform_resume(VCHIQ_STATE_T *state)
+vchiq_platform_resume(struct vchiq_state *state)
 {
return VCHIQ_SUCCESS;
 }
 
 void
-vchiq_platform_paused(VCHIQ_STATE_T *state)
+vchiq_platform_paused(struct vchiq_state *state)
 {
 }
 
 void
-vchiq_platform_resumed(VCHIQ_STATE_T *state)
+vchiq_platform_resumed(struct vchiq_state *state)
 {
 }
 
 int
-vchiq_platform_videocore_wanted(VCHIQ_STATE_T *state)
+vchiq_platform_videocore_wanted(struct vchiq_state *state)
 {
return 1; // autosuspend not supported - videocore always wanted
 }
@@ -324,12 +324,12 @@ vchiq_platform_use_suspend_timer(void)
return 0;
 }
 void
-vchiq_dump_platform_use_state(VCHIQ_STATE_T *state)
+vchiq_dump_platform_use_state(struct vchiq_state *state)
 {
vchiq_log_info(vchiq_arm_log_level, "Suspend timer not in use");
 }
 void
-vchiq_platform_handle_timeout(VCHIQ_STATE_T *state)
+vchiq_platform_handle_timeout(struct vchiq_state *state)
 {
(void)state;
 }
@@ -340,7 +340,7 @@ vchiq_platform_handle_timeout(VCHIQ_STATE_T *state)
 static irqreturn_t
 vchiq_doorbell_irq(int irq, void *dev_id)
 {
-   VCHIQ_STATE_T *state = dev_id;
+   struct vchiq_state *state = dev_id;
irqreturn_t ret = IRQ_NONE;
unsigned int status;
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 7ce7e1a4dafe..c02f755b91f5 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -133,7 +133,7 @@ struct bulk_waiter_node {
 };
 
 struct vchiq_instance_struct {
-   VCHIQ_STATE_T *state;
+   struct vchiq_state *state;
struct vchiq_completion_data completions[MAX_COMPLETIONS];
int completion_insert;
int completion_remove;
@@ -163,7 +163,7 @@ struct dump_context {
 
 static struct cdevvchiq_cdev;
 static dev_t  vchiq_devid;
-static VCHIQ_STATE_T g_state;
+static struct vchiq_state g_state;
 static struct class  *vchiq_class;
 static DEFINE_SPINLOCK(msg_queue_spinlock);
 static struct platform_device *bcm2835_camera;
@@ -209,7 +209,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, 
void *data,
 VCHIQ_STATUS_T vchiq_initialise(VCHIQ_INSTANCE_T *instance_out)
 {
VCHIQ_STATUS_T status = VCHIQ_ERROR;
-   VCHIQ_STATE_T *state;
+   struct vchiq_state *state;
VCHIQ_INSTANCE_T instance = NULL;
int i;
 
@@ -262,7 +262,7 @@ EXPORT_SYMBOL(vchiq_initialise);
 VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance)
 {
VCHIQ_STATUS_T status;
-   VCHIQ_STATE_T *state = instance->state;
+   struct vchiq_state *state = instance->state;
 
vchiq_log_trace(vchiq_core_log_level,
"%s(%p) called", __func__, instance);
@@ -304,7 +304,7 @@ static int vchiq_is_connected(VCHIQ_INSTANCE_T instance)
 VCHIQ_STATUS_T vchiq_connect(VCHIQ

[PATCH v2 30/33] staging: vc04_services: Remove VCHIQ_SLOT_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_core.c  | 2 +-
 .../staging/vc04_services/interface/vchiq_arm/vchiq_core.h  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 8402c6b9bbc3..d92245bcebaf 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -2182,7 +2182,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T 
*slot_zero)
 
state->local = local;
state->remote = remote;
-   state->slot_data = (VCHIQ_SLOT_T *)slot_zero;
+   state->slot_data = (struct vchiq_slot *)slot_zero;
 
/*
initialize events and mutexes
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 214939f6631e..0cdd66312b78 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -270,9 +270,9 @@ typedef struct opaque_platform_state_t 
*VCHIQ_PLATFORM_STATE_T;
 
 typedef struct vchiq_state_struct VCHIQ_STATE_T;
 
-typedef struct vchiq_slot_struct {
+struct vchiq_slot {
char data[VCHIQ_SLOT_SIZE];
-} VCHIQ_SLOT_T;
+};
 
 struct vchiq_slot_info {
/* Use two counters rather than one to avoid the need for a mutex. */
@@ -404,7 +404,7 @@ struct vchiq_state_struct {
 
struct vchiq_shared_state *local;
struct vchiq_shared_state *remote;
-   VCHIQ_SLOT_T *slot_data;
+   struct vchiq_slot *slot_data;
 
unsigned short default_slot_quota;
unsigned short default_message_quota;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 13/33] staging: vc04_services: Remove VCHIQ_COMPLETION_DATA_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_arm.c   | 21 ++-
 .../interface/vchiq_arm/vchiq_ioctl.h |  6 +++---
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 1d0230db7b50..01beb990a023 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -134,7 +134,7 @@ struct bulk_waiter_node {
 
 struct vchiq_instance_struct {
VCHIQ_STATE_T *state;
-   VCHIQ_COMPLETION_DATA_T completions[MAX_COMPLETIONS];
+   struct vchiq_completion_data completions[MAX_COMPLETIONS];
int completion_insert;
int completion_remove;
struct completion insert_event;
@@ -549,7 +549,7 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T 
reason,
VCHIQ_HEADER_T *header, struct user_service *user_service,
void *bulk_userdata)
 {
-   VCHIQ_COMPLETION_DATA_T *completion;
+   struct vchiq_completion_data *completion;
int insert;
 
DEBUG_INITIALISE(g_state.local)
@@ -1202,7 +1202,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
int remove = instance->completion_remove;
 
for (ret = 0; ret < args.count; ret++) {
-   VCHIQ_COMPLETION_DATA_T *completion;
+   struct vchiq_completion_data *completion;
VCHIQ_SERVICE_T *service;
struct user_service *user_service;
VCHIQ_HEADER_T *header;
@@ -1283,10 +1283,11 @@ vchiq_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
unlock_service(service);
 
if (copy_to_user((void __user *)(
-   (size_t)args.buf +
-   ret * sizeof(VCHIQ_COMPLETION_DATA_T)),
+   (size_t)args.buf + ret *
+   sizeof(struct vchiq_completion_data)),
completion,
-   sizeof(VCHIQ_COMPLETION_DATA_T)) != 0) {
+   sizeof(struct vchiq_completion_data))
+   != 0) {
if (ret == 0)
ret = -EFAULT;
break;
@@ -1728,8 +1729,8 @@ vchiq_compat_ioctl_await_completion(struct file *file,
unsigned long arg)
 {
struct vchiq_await_completion __user *args;
-   VCHIQ_COMPLETION_DATA_T __user *completion;
-   VCHIQ_COMPLETION_DATA_T completiontemp;
+   struct vchiq_completion_data __user *completion;
+   struct vchiq_completion_data completiontemp;
struct vchiq_await_completion32 args32;
struct vchiq_completion_data32 completion32;
unsigned int __user *msgbufcount32;
@@ -1745,7 +1746,7 @@ vchiq_compat_ioctl_await_completion(struct file *file,
if (!args)
return -EFAULT;
 
-   completion = (VCHIQ_COMPLETION_DATA_T __user *)(args + 1);
+   completion = (struct vchiq_completion_data __user *)(args + 1);
msgbufptr = (void * __user *)(completion + 1);
 
if (copy_from_user(&args32,
@@ -2062,7 +2063,7 @@ static int vchiq_release(struct inode *inode, struct file 
*file)
/* Release any closed services */
while (instance->completion_remove !=
instance->completion_insert) {
-   VCHIQ_COMPLETION_DATA_T *completion;
+   struct vchiq_completion_data *completion;
VCHIQ_SERVICE_T *service;
 
completion = &instance->completions[
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index 37bef2652411..251c82b9ea22 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -61,16 +61,16 @@ typedef struct {
VCHIQ_BULK_MODE_T mode;
 } VCHIQ_QUEUE_BULK_TRANSFER_T;
 
-typedef struct {
+struct vchiq_completion_data {
VCHIQ_REASON_T reason;
VCHIQ_HEADER_T *header;
void *service_userdata;
void *bulk_userdata;
-} VCHIQ_COMPLETION_DATA_T;
+};
 
 struct vchiq_await_completion {
unsigned int count;
-   VCHIQ_COMPLETION_DATA_T *buf;
+   struct vchiq_completion_data *buf;
unsigned int msgbufsize;
unsigned int msgb

[PATCH v2 12/33] staging: vc04_services: Remove VCHIQ_BULK_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_2835_arm.c|  5 +++--
 .../vc04_services/interface/vchiq_arm/vchiq_arm.c   |  4 ++--
 .../vc04_services/interface/vchiq_arm/vchiq_core.c  |  9 +
 .../vc04_services/interface/vchiq_arm/vchiq_core.h  | 13 +++--
 4 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 384b8b7f2cf1..6fa965ead636 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -247,7 +247,8 @@ remote_event_signal(struct remote_event *event)
 }
 
 VCHIQ_STATUS_T
-vchiq_prepare_bulk_data(VCHIQ_BULK_T *bulk, void *offset, int size, int dir)
+vchiq_prepare_bulk_data(struct vchiq_bulk *bulk, void *offset, int size,
+   int dir)
 {
struct vchiq_pagelist_info *pagelistinfo;
 
@@ -271,7 +272,7 @@ vchiq_prepare_bulk_data(VCHIQ_BULK_T *bulk, void *offset, 
int size, int dir)
 }
 
 void
-vchiq_complete_bulk(VCHIQ_BULK_T *bulk)
+vchiq_complete_bulk(struct vchiq_bulk *bulk)
 {
if (bulk && bulk->remote_data && bulk->actual)
free_pagelist((struct vchiq_pagelist_info *)bulk->remote_data,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 16815763130e..1d0230db7b50 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -485,7 +485,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, 
void *data,
mutex_unlock(&instance->bulk_waiter_list_mutex);
 
if (waiter) {
-   VCHIQ_BULK_T *bulk = waiter->bulk_waiter.bulk;
+   struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk;
 
if (bulk) {
/* This thread has an outstanding bulk transfer. */
@@ -515,7 +515,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, 
void *data,
 VCHIQ_BULK_MODE_BLOCKING, dir);
if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) ||
!waiter->bulk_waiter.bulk) {
-   VCHIQ_BULK_T *bulk = waiter->bulk_waiter.bulk;
+   struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk;
 
if (bulk) {
/* Cancel the signal when the transfer
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 8aff56ee6d4f..bba82d381e73 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -1217,7 +1217,7 @@ notify_bulks(VCHIQ_SERVICE_T *service, struct 
vchiq_bulk_queue *queue,
 
if (status == VCHIQ_SUCCESS) {
while (queue->remove != queue->remote_notify) {
-   VCHIQ_BULK_T *bulk =
+   struct vchiq_bulk *bulk =
&queue->bulks[BULK_INDEX(queue->remove)];
 
/* Only generate callbacks for non-dummy bulk
@@ -1368,7 +1368,8 @@ abort_outstanding_bulks(VCHIQ_SERVICE_T *service,
 
while ((queue->process != queue->local_insert) ||
(queue->process != queue->remote_insert)) {
-   VCHIQ_BULK_T *bulk = &queue->bulks[BULK_INDEX(queue->process)];
+   struct vchiq_bulk *bulk =
+   &queue->bulks[BULK_INDEX(queue->process)];
 
if (queue->process == queue->remote_insert) {
/* fabricate a matching dummy bulk */
@@ -1734,7 +1735,7 @@ parse_rx_slots(VCHIQ_STATE_T *state)
&& (service->srvstate !=
VCHIQ_SRVSTATE_FREE)) {
struct vchiq_bulk_queue *queue;
-   VCHIQ_BULK_T *bulk;
+   struct vchiq_bulk *bulk;
 
queue = (type == VCHIQ_MSG_BULK_RX_DONE) ?
&service->bulk_rx : &service->bulk_tx;
@@ -3019,7 +3020,7 @@ VCHIQ_STATUS_T vchiq_bulk_transfer(VCHIQ_SERVICE_HANDLE_T 
handle,
 {
VCHIQ_SERVICE_T *service = find_service_by_handle(handle);
struct vchiq_bulk_queue *queue;
-   VCHIQ_BULK_T *bulk;
+   struct vchiq_bulk *bulk;
VCHIQ_STATE_T *state;
struct bulk_waiter *bulk_waiter = NULL;
const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r';
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index

[PATCH v2 29/33] staging: vc04_services: Remove VCHIQ_SLOT_INFO_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../vc04_services/interface/vchiq_arm/vchiq_core.c| 11 ++-
 .../vc04_services/interface/vchiq_arm/vchiq_core.h| 10 +-
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 5071d4e27acc..8402c6b9bbc3 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -1139,13 +1139,13 @@ queue_message_sync(VCHIQ_STATE_T *state, struct 
vchiq_service *service,
 }
 
 static inline void
-claim_slot(VCHIQ_SLOT_INFO_T *slot)
+claim_slot(struct vchiq_slot_info *slot)
 {
slot->use_count++;
 }
 
 static void
-release_slot(VCHIQ_STATE_T *state, VCHIQ_SLOT_INFO_T *slot_info,
+release_slot(VCHIQ_STATE_T *state, struct vchiq_slot_info *slot_info,
 struct vchiq_header *header, struct vchiq_service *service)
 {
int release_count;
@@ -2492,7 +2492,7 @@ release_service_messages(struct vchiq_service *service)
}
 
for (i = state->remote->slot_first; i <= slot_last; i++) {
-   VCHIQ_SLOT_INFO_T *slot_info =
+   struct vchiq_slot_info *slot_info =
SLOT_INFO_FROM_INDEX(state, i);
if (slot_info->release_count != slot_info->use_count) {
char *data =
@@ -3235,7 +3235,7 @@ vchiq_release_message(VCHIQ_SERVICE_HANDLE_T handle,
int msgid = header->msgid;
 
if (msgid & VCHIQ_MSGID_CLAIMED) {
-   VCHIQ_SLOT_INFO_T *slot_info =
+   struct vchiq_slot_info *slot_info =
SLOT_INFO_FROM_INDEX(state, slot_index);
 
release_slot(state, slot_info, header, service);
@@ -3391,7 +3391,8 @@ vchiq_dump_shared_state(void *dump_context, VCHIQ_STATE_T 
*state,
vchiq_dump(dump_context, buf, len + 1);
 
for (i = shared->slot_first; i <= shared->slot_last; i++) {
-   VCHIQ_SLOT_INFO_T slot_info = *SLOT_INFO_FROM_INDEX(state, i);
+   struct vchiq_slot_info slot_info =
+   *SLOT_INFO_FROM_INDEX(state, i);
if (slot_info.use_count != slot_info.release_count) {
len = snprintf(buf, sizeof(buf),
"  %d: %d/%d", i, slot_info.use_count,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 95b1bd18809c..214939f6631e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -274,11 +274,11 @@ typedef struct vchiq_slot_struct {
char data[VCHIQ_SLOT_SIZE];
 } VCHIQ_SLOT_T;
 
-typedef struct vchiq_slot_info_struct {
+struct vchiq_slot_info {
/* Use two counters rather than one to avoid the need for a mutex. */
short use_count;
short release_count;
-} VCHIQ_SLOT_INFO_T;
+};
 
 struct vchiq_service {
struct vchiq_service_base base;
@@ -393,7 +393,7 @@ typedef struct vchiq_slot_zero_struct {
int platform_data[2];
struct vchiq_shared_state master;
struct vchiq_shared_state slave;
-   VCHIQ_SLOT_INFO_T slots[VCHIQ_MAX_SLOTS];
+   struct vchiq_slot_info slots[VCHIQ_MAX_SLOTS];
 } VCHIQ_SLOT_ZERO_T;
 
 struct vchiq_state_struct {
@@ -439,7 +439,7 @@ struct vchiq_state_struct {
 
char *tx_data;
char *rx_data;
-   VCHIQ_SLOT_INFO_T *rx_info;
+   struct vchiq_slot_info *rx_info;
 
struct mutex slot_mutex;
 
@@ -498,7 +498,7 @@ struct vchiq_state_struct {
 
struct vchiq_service *services[VCHIQ_MAX_SERVICES];
struct vchiq_service_quota service_quotas[VCHIQ_MAX_SERVICES];
-   VCHIQ_SLOT_INFO_T slot_info[VCHIQ_MAX_SLOTS];
+   struct vchiq_slot_info slot_info[VCHIQ_MAX_SLOTS];
 
VCHIQ_PLATFORM_STATE_T platform_state;
 };
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 27/33] staging: vc04_services: Remove VCHIQ_SET_SERVICE_OPTION_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c   | 2 +-
 .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index fae0ab61ceee..7ce7e1a4dafe 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1430,7 +1430,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
} break;
 
case VCHIQ_IOC_SET_SERVICE_OPTION: {
-   VCHIQ_SET_SERVICE_OPTION_T args;
+   struct vchiq_set_service_option args;
 
if (copy_from_user(
&args, (const void __user *)arg,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index 80c246c033b2..56aef490e870 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -88,11 +88,11 @@ struct vchiq_get_config {
struct vchiq_config __user *pconfig;
 };
 
-typedef struct {
+struct vchiq_set_service_option {
unsigned int handle;
VCHIQ_SERVICE_OPTION_T option;
int value;
-} VCHIQ_SET_SERVICE_OPTION_T;
+};
 
 struct vchiq_dump_mem {
void *virt_addr;
@@ -121,7 +121,7 @@ struct vchiq_dump_mem {
 #define VCHIQ_IOC_USE_SERVICE  _IO(VCHIQ_IOC_MAGIC,   12)
 #define VCHIQ_IOC_RELEASE_SERVICE  _IO(VCHIQ_IOC_MAGIC,   13)
 #define VCHIQ_IOC_SET_SERVICE_OPTION \
-   _IOW(VCHIQ_IOC_MAGIC,  14, VCHIQ_SET_SERVICE_OPTION_T)
+   _IOW(VCHIQ_IOC_MAGIC,  14, struct vchiq_set_service_option)
 #define VCHIQ_IOC_DUMP_PHYS_MEM \
_IOW(VCHIQ_IOC_MAGIC,  15, struct vchiq_dump_mem)
 #define VCHIQ_IOC_LIB_VERSION  _IO(VCHIQ_IOC_MAGIC,   16)
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 24/33] staging: vc04_services: Remove VCHIQ_SERVICE_PARAMS_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 6 +++---
 .../vc04_services/interface/vchiq_arm/vchiq_core.c| 2 +-
 .../vc04_services/interface/vchiq_arm/vchiq_core.h| 2 +-
 .../staging/vc04_services/interface/vchiq_arm/vchiq_if.h  | 8 
 .../vc04_services/interface/vchiq_arm/vchiq_ioctl.h   | 2 +-
 .../vc04_services/interface/vchiq_arm/vchiq_shim.c| 2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index f10565a939d7..f997bf69d03b 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -332,7 +332,7 @@ EXPORT_SYMBOL(vchiq_connect);
 
 VCHIQ_STATUS_T vchiq_add_service(
VCHIQ_INSTANCE_T  instance,
-   const VCHIQ_SERVICE_PARAMS_T *params,
+   const struct vchiq_service_params *params,
VCHIQ_SERVICE_HANDLE_T   *phandle)
 {
VCHIQ_STATUS_T status;
@@ -371,7 +371,7 @@ EXPORT_SYMBOL(vchiq_add_service);
 
 VCHIQ_STATUS_T vchiq_open_service(
VCHIQ_INSTANCE_T  instance,
-   const VCHIQ_SERVICE_PARAMS_T *params,
+   const struct vchiq_service_params *params,
VCHIQ_SERVICE_HANDLE_T   *phandle)
 {
VCHIQ_STATUS_T   status = VCHIQ_ERROR;
@@ -2330,7 +2330,7 @@ vchiq_keepalive_thread_func(void *v)
VCHIQ_INSTANCE_T instance;
VCHIQ_SERVICE_HANDLE_T ka_handle;
 
-   VCHIQ_SERVICE_PARAMS_T params = {
+   struct vchiq_service_params params = {
.fourcc  = VCHIQ_MAKE_FOURCC('K', 'E', 'E', 'P'),
.callback= vchiq_keepalive_vchiq_callback,
.version = KEEPALIVE_VER,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index e5549d540cad..2c48b2b4f43a 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -2305,7 +2305,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T 
*slot_zero)
 /* Called from application thread when a client or server service is created. 
*/
 VCHIQ_SERVICE_T *
 vchiq_add_service_internal(VCHIQ_STATE_T *state,
-   const VCHIQ_SERVICE_PARAMS_T *params, int srvstate,
+   const struct vchiq_service_params *params, int srvstate,
VCHIQ_INSTANCE_T instance, VCHIQ_USERDATA_TERM_T userdata_term)
 {
VCHIQ_SERVICE_T *service;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 3d7a15b9b786..62d914108183 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -531,7 +531,7 @@ vchiq_connect_internal(VCHIQ_STATE_T *state, 
VCHIQ_INSTANCE_T instance);
 
 extern VCHIQ_SERVICE_T *
 vchiq_add_service_internal(VCHIQ_STATE_T *state,
-   const VCHIQ_SERVICE_PARAMS_T *params, int srvstate,
+   const struct vchiq_service_params *params, int srvstate,
VCHIQ_INSTANCE_T instance, VCHIQ_USERDATA_TERM_T userdata_term);
 
 extern VCHIQ_STATUS_T
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index aaf1bee3ca0c..13ed23eacfae 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -103,13 +103,13 @@ struct vchiq_service_base {
void *userdata;
 };
 
-typedef struct vchiq_service_params_struct {
+struct vchiq_service_params {
int fourcc;
VCHIQ_CALLBACK_T callback;
void *userdata;
short version;   /* Increment for non-trivial changes */
short version_min;   /* Update for incompatible changes */
-} VCHIQ_SERVICE_PARAMS_T;
+};
 
 struct vchiq_config {
unsigned int max_msg_size;
@@ -129,10 +129,10 @@ extern VCHIQ_STATUS_T vchiq_initialise(VCHIQ_INSTANCE_T 
*pinstance);
 extern VCHIQ_STATUS_T vchiq_shutdown(VCHIQ_INSTANCE_T instance);
 extern VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance);
 extern VCHIQ_STATUS_T vchiq_add_service(VCHIQ_INSTANCE_T instance,
-   const VCHIQ_SERVICE_PARAMS_T *params,
+   const struct vchiq_service_params *params,
VCHIQ_SERVICE_HANDLE_T *pservice);
 extern VCHIQ_STATUS_T vchiq_open_service(VCHIQ_INSTANCE_T instance,
-   const VCHIQ_SERVICE_PARAMS_T *params,
+   const struct vchiq_service_params *params,
VCHIQ_SERVICE_HANDLE_T *pservice);
 extern VCHIQ_STATUS_T vchiq_close_service(VCHIQ_SERVICE_HANDLE_T service);
 extern VCHIQ_STATUS_T vchiq_remove_service(VCHIQ

[PATCH v2 09/33] staging: vc04_services: Remove VCHIQ_ARM_STATE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_2835_arm.c  |  4 +-
 .../interface/vchiq_arm/vchiq_arm.c   | 55 ++-
 .../interface/vchiq_arm/vchiq_arm.h   | 18 +++---
 3 files changed, 39 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index ae410fd2b314..384b8b7f2cf1 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -61,7 +61,7 @@
 
 struct vchiq_2835_state {
int inited;
-   VCHIQ_ARM_STATE_T arm_state;
+   struct vchiq_arm_state arm_state;
 };
 
 struct vchiq_pagelist_info {
@@ -221,7 +221,7 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state)
return status;
 }
 
-VCHIQ_ARM_STATE_T*
+struct vchiq_arm_state*
 vchiq_platform_get_arm_state(VCHIQ_STATE_T *state)
 {
struct vchiq_2835_state *platform_state;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 50b874271cea..57b6c3f0e7ef 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -2290,7 +2290,7 @@ vchiq_fops = {
 int
 vchiq_videocore_wanted(VCHIQ_STATE_T *state)
 {
-   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
+   struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
 
if (!arm_state)
/* autosuspend not supported - always return wanted */
@@ -2323,7 +2323,7 @@ static int
 vchiq_keepalive_thread_func(void *v)
 {
VCHIQ_STATE_T *state = (VCHIQ_STATE_T *) v;
-   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
+   struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
 
VCHIQ_STATUS_T status;
VCHIQ_INSTANCE_T instance;
@@ -2401,7 +2401,7 @@ vchiq_keepalive_thread_func(void *v)
 }
 
 VCHIQ_STATUS_T
-vchiq_arm_init_state(VCHIQ_STATE_T *state, VCHIQ_ARM_STATE_T *arm_state)
+vchiq_arm_init_state(VCHIQ_STATE_T *state, struct vchiq_arm_state *arm_state)
 {
if (arm_state) {
rwlock_init(&arm_state->susp_res_lock);
@@ -2497,8 +2497,8 @@ vchiq_arm_init_state(VCHIQ_STATE_T *state, 
VCHIQ_ARM_STATE_T *arm_state)
 */
 
 void
-set_suspend_state(VCHIQ_ARM_STATE_T *arm_state,
-   enum vc_suspend_status new_state)
+set_suspend_state(struct vchiq_arm_state *arm_state,
+ enum vc_suspend_status new_state)
 {
/* set the state in all cases */
arm_state->vc_suspend_state = new_state;
@@ -2534,8 +2534,8 @@ set_suspend_state(VCHIQ_ARM_STATE_T *arm_state,
 }
 
 void
-set_resume_state(VCHIQ_ARM_STATE_T *arm_state,
-   enum vc_resume_status new_state)
+set_resume_state(struct vchiq_arm_state *arm_state,
+enum vc_resume_status new_state)
 {
/* set the state in all cases */
arm_state->vc_resume_state = new_state;
@@ -2563,7 +2563,7 @@ set_resume_state(VCHIQ_ARM_STATE_T *arm_state,
 
 /* should be called with the write lock held */
 inline void
-start_suspend_timer(VCHIQ_ARM_STATE_T *arm_state)
+start_suspend_timer(struct vchiq_arm_state *arm_state)
 {
del_timer(&arm_state->suspend_timer);
arm_state->suspend_timer.expires = jiffies +
@@ -2574,7 +2574,7 @@ start_suspend_timer(VCHIQ_ARM_STATE_T *arm_state)
 
 /* should be called with the write lock held */
 static inline void
-stop_suspend_timer(VCHIQ_ARM_STATE_T *arm_state)
+stop_suspend_timer(struct vchiq_arm_state *arm_state)
 {
if (arm_state->suspend_timer_running) {
del_timer(&arm_state->suspend_timer);
@@ -2585,7 +2585,7 @@ stop_suspend_timer(VCHIQ_ARM_STATE_T *arm_state)
 static inline int
 need_resume(VCHIQ_STATE_T *state)
 {
-   VCHIQ_ARM_STATE_T *arm_state = vchiq_platform_get_arm_state(state);
+   struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
 
return (arm_state->vc_suspend_state > VC_SUSPEND_IDLE) &&
(arm_state->vc_resume_state < VC_RESUME_REQUESTED) &&
@@ -2593,7 +2593,7 @@ need_resume(VCHIQ_STATE_T *state)
 }
 
 static int
-block_resume(VCHIQ_ARM_STATE_T *arm_state)
+block_resume(struct vchiq_arm_state *arm_state)
 {
int status = VCHIQ_SUCCESS;
const unsigned long timeout_val =
@@ -2659,7 +2659,7 @@ block_resume(VCHIQ_ARM_STATE_T *arm_state)
 }
 
 static inline void
-unblock_resume(VCHIQ_ARM_STATE_T *arm_state)
+unblock_resume(struct vchiq_arm_state *arm_state)
 {
complete_all(&arm_state->resume_blocker);
arm_state->resume_blocked = 0;
@@ -2671,7 +2671,7 @@ VCHIQ_STATUS_T
 vchiq_arm_vcsuspend(VCHIQ_STATE_T *state)
 {
VCHIQ_STATUS_T status = VCHIQ_ERROR;
-  

[PATCH v2 25/33] staging: vc04_services: Remove VCHIQ_SERVICE_QUOTA_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../interface/vchiq_arm/vchiq_core.c | 16 
 .../interface/vchiq_arm/vchiq_core.h |  6 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 2c48b2b4f43a..8dec156f2dce 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -358,7 +358,7 @@ static void
 mark_service_closing_internal(VCHIQ_SERVICE_T *service, int sh_thread)
 {
VCHIQ_STATE_T *state = service->state;
-   VCHIQ_SERVICE_QUOTA_T *service_quota;
+   struct vchiq_service_quota *service_quota;
 
service->closing = 1;
 
@@ -661,7 +661,7 @@ process_free_queue(VCHIQ_STATE_T *state, BITSET_T 
*service_found, size_t length)
 
if (VCHIQ_MSG_TYPE(msgid) == VCHIQ_MSG_DATA) {
int port = VCHIQ_MSG_SRCPORT(msgid);
-   VCHIQ_SERVICE_QUOTA_T *service_quota =
+   struct vchiq_service_quota *service_quota =
&state->service_quotas[port];
int count;
 
@@ -809,7 +809,7 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T 
*service,
int flags)
 {
VCHIQ_SHARED_STATE_T *local;
-   VCHIQ_SERVICE_QUOTA_T *service_quota = NULL;
+   struct vchiq_service_quota *service_quota = NULL;
struct vchiq_header *header;
int type = VCHIQ_MSG_TYPE(msgid);
 
@@ -2207,7 +2207,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T 
*slot_zero)
state->slot_queue_available = 0;
 
for (i = 0; i < VCHIQ_MAX_SERVICES; i++) {
-   VCHIQ_SERVICE_QUOTA_T *service_quota =
+   struct vchiq_service_quota *service_quota =
&state->service_quotas[i];
init_completion(&service_quota->quota_event);
}
@@ -2310,7 +2310,7 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state,
 {
VCHIQ_SERVICE_T *service;
VCHIQ_SERVICE_T **pservice = NULL;
-   VCHIQ_SERVICE_QUOTA_T *service_quota;
+   struct vchiq_service_quota *service_quota;
int i;
 
service = kmalloc(sizeof(VCHIQ_SERVICE_T), GFP_KERNEL);
@@ -3302,7 +3302,7 @@ vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T handle,
break;
 
case VCHIQ_SERVICE_OPTION_SLOT_QUOTA: {
-   VCHIQ_SERVICE_QUOTA_T *service_quota =
+   struct vchiq_service_quota *service_quota =
&service->state->service_quotas[
service->localport];
if (value == 0)
@@ -3322,7 +3322,7 @@ vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T handle,
} break;
 
case VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA: {
-   VCHIQ_SERVICE_QUOTA_T *service_quota =
+   struct vchiq_service_quota *service_quota =
&service->state->service_quotas[
service->localport];
if (value == 0)
@@ -3484,7 +3484,7 @@ vchiq_dump_service_state(void *dump_context, 
VCHIQ_SERVICE_T *service)
 
if (service->srvstate != VCHIQ_SRVSTATE_FREE) {
char remoteport[30];
-   VCHIQ_SERVICE_QUOTA_T *service_quota =
+   struct vchiq_service_quota *service_quota =
&service->state->service_quotas[service->localport];
int fourcc = service->base.fourcc;
int tx_pending, rx_pending;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 62d914108183..11dabe464c9b 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -332,14 +332,14 @@ typedef struct vchiq_service_struct {
statically allocated, since for accounting reasons a service's slot
usage is carried over between users of the same port number.
  */
-typedef struct vchiq_service_quota_struct {
+struct vchiq_service_quota {
unsigned short slot_quota;
unsigned short slot_use_count;
unsigned short message_quota;
unsigned short message_use_count;
struct completion quota_event;
int previous_tx_index;
-} VCHIQ_SERVICE_QUOTA_T;
+};
 
 typedef struct vchiq_shared_state_struct {
 
@@ -497,7 +497,7 @@ struct vchiq_state_struct {
} stats;
 
VCHIQ_SERVICE_T * services[VCHIQ_MAX_SERVICES];
-   VCHIQ_SERVICE_QUOTA_T service_quotas[VCHIQ_MAX_SERVICES];

[PATCH v2 22/33] staging: vc04_services: Remove VCHIQ_QUEUE_MESSAGE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c   | 4 ++--
 .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 2df308b6a675..f10565a939d7 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -1042,7 +1042,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
} break;
 
case VCHIQ_IOC_QUEUE_MESSAGE: {
-   VCHIQ_QUEUE_MESSAGE_T args;
+   struct vchiq_queue_message args;
 
if (copy_from_user
 (&args, (const void __user *)arg,
@@ -1595,7 +1595,7 @@ vchiq_compat_ioctl_queue_message(struct file *file,
 unsigned int cmd,
 unsigned long arg)
 {
-   VCHIQ_QUEUE_MESSAGE_T *args;
+   struct vchiq_queue_message *args;
struct vchiq_element __user *elements;
struct vchiq_queue_message32 args32;
unsigned int count;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index 284ce4faa384..9e21d1c472de 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -47,11 +47,11 @@ struct vchiq_create_service {
unsigned int handle;   /* OUT */
 };
 
-typedef struct {
+struct vchiq_queue_message {
unsigned int handle;
unsigned int count;
const struct vchiq_element __user *elements;
-} VCHIQ_QUEUE_MESSAGE_T;
+};
 
 struct vchiq_queue_bulk_transfer {
unsigned int handle;
@@ -105,7 +105,7 @@ struct vchiq_dump_mem {
_IOWR(VCHIQ_IOC_MAGIC, 2, struct vchiq_create_service)
 #define VCHIQ_IOC_REMOVE_SERVICE   _IO(VCHIQ_IOC_MAGIC,   3)
 #define VCHIQ_IOC_QUEUE_MESSAGE \
-   _IOW(VCHIQ_IOC_MAGIC,  4, VCHIQ_QUEUE_MESSAGE_T)
+   _IOW(VCHIQ_IOC_MAGIC,  4, struct vchiq_queue_message)
 #define VCHIQ_IOC_QUEUE_BULK_TRANSMIT \
_IOWR(VCHIQ_IOC_MAGIC, 5, struct vchiq_queue_bulk_transfer)
 #define VCHIQ_IOC_QUEUE_BULK_RECEIVE \
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 23/33] staging: vc04_services: Remove VCHIQ_SERVICE_BASE_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_core.h| 2 +-
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 789aeb130639..3d7a15b9b786 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -281,7 +281,7 @@ typedef struct vchiq_slot_info_struct {
 } VCHIQ_SLOT_INFO_T;
 
 typedef struct vchiq_service_struct {
-   VCHIQ_SERVICE_BASE_T base;
+   struct vchiq_service_base base;
VCHIQ_SERVICE_HANDLE_T handle;
unsigned int ref_count;
int srvstate;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
index e5410df15c81..aaf1bee3ca0c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
@@ -97,11 +97,11 @@ typedef VCHIQ_STATUS_T (*VCHIQ_CALLBACK_T)(VCHIQ_REASON_T,
   struct vchiq_header *,
   VCHIQ_SERVICE_HANDLE_T, void *);
 
-typedef struct vchiq_service_base_struct {
+struct vchiq_service_base {
int fourcc;
VCHIQ_CALLBACK_T callback;
void *userdata;
-} VCHIQ_SERVICE_BASE_T;
+};
 
 typedef struct vchiq_service_params_struct {
int fourcc;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 18/33] staging: vc04_services: Remove VCHIQ_DUMP_MEM_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index aaf825f7a0f7..f4d8bd2b3c6b 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -94,10 +94,10 @@ typedef struct {
int value;
 } VCHIQ_SET_SERVICE_OPTION_T;
 
-typedef struct {
+struct vchiq_dump_mem {
void *virt_addr;
size_tnum_bytes;
-} VCHIQ_DUMP_MEM_T;
+};
 
 #define VCHIQ_IOC_CONNECT  _IO(VCHIQ_IOC_MAGIC,   0)
 #define VCHIQ_IOC_SHUTDOWN _IO(VCHIQ_IOC_MAGIC,   1)
@@ -123,7 +123,7 @@ typedef struct {
 #define VCHIQ_IOC_SET_SERVICE_OPTION \
_IOW(VCHIQ_IOC_MAGIC,  14, VCHIQ_SET_SERVICE_OPTION_T)
 #define VCHIQ_IOC_DUMP_PHYS_MEM \
-   _IOW(VCHIQ_IOC_MAGIC,  15, VCHIQ_DUMP_MEM_T)
+   _IOW(VCHIQ_IOC_MAGIC,  15, struct vchiq_dump_mem)
 #define VCHIQ_IOC_LIB_VERSION  _IO(VCHIQ_IOC_MAGIC,   16)
 #define VCHIQ_IOC_CLOSE_DELIVERED  _IO(VCHIQ_IOC_MAGIC,   17)
 #define VCHIQ_IOC_MAX  17
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] binder: implement binderfs

2018-12-14 Thread Christian Brauner
As discussed at Linux Plumbers Conference 2018 in Vancouver [1] this is the
implementation of binderfs.

/* Abstract */
binderfs is a backwards-compatible filesystem for Android's binder ipc
mechanism. Each ipc namespace will mount a new binderfs instance. Mounting
binderfs multiple times at different locations in the same ipc namespace
will not cause a new super block to be allocated and hence it will be the
same filesystem instance.
Each new binderfs mount will have its own set of binder devices only
visible in the ipc namespace it has been mounted in. All devices in a new
binderfs mount will follow the scheme binder%d and numbering will always
start at 0.

/* Backwards compatibility */
Devices requested in the Kconfig via CONFIG_ANDROID_BINDER_DEVICES for the
initial ipc namespace will work as before. They will be registered via
misc_register() and appear in the devtmpfs mount. Specifically, the
standard devices binder, hwbinder, and vndbinder will all appear in their
standard locations in /dev. Mounting or unmounting the binderfs mount in
the initial ipc namespace will have no effect on these devices, i.e. they
will neither show up in the binderfs mount nor will they disappear when the
binderfs mount is gone.

/* binder-control */
Each new binderfs instance comes with a binder-control device. No other
devices will be present at first. The binder-control device can be used to
dynamically allocate binder devices. All requests operate on the binderfs
mount the binder-control device resides in.
Assuming a new instance of binderfs has been mounted at /dev/binderfs
via mount -t binderfs binderfs /dev/binderfs. Then a request to create a
new binder device can be made as illustrated in [2].
Binderfs devices can simply be removed via unlink().

/* Implementation details */
- dynamic major number allocation:
  When binderfs is registered as a new filesystem it will dynamically
  allocate a new major number. The allocated major number will be returned
  in struct binderfs_device when a new binder device is allocated.
- global minor number tracking:
  Minor are tracked in a global idr struct that is capped at
  BINDERFS_MAX_MINOR. The minor number tracker is protected by a global
  mutex. This is the only point of contention between binderfs mounts.
- struct binderfs_info:
  Each binderfs super block has its own struct binderfs_info that tracks
  specific details about a binderfs instance:
  - ipc namespace
  - dentry of the binder-control device
  - root uid and root gid of the user namespace the binderfs instance
was mounted in
- mountable by user namespace root:
  binderfs can be mounted by user namespace root in a non-initial user
  namespace. The devices will be owned by user namespace root.
- binderfs binder devices without misc infrastructure:
  New binder devices associated with a binderfs mount do not use the
  full misc_register() infrastructure.
  The misc_register() infrastructure can only create new devices in the
  host's devtmpfs mount. binderfs does however only make devices appear
  under its own mountpoint and thus allocates new character device nodes
  from the inode of the root dentry of the super block. This will have
  the side-effect that binderfs specific device nodes do not appear in
  sysfs. This behavior is similar to devpts allocated pts devices and
  has no effect on the functionality of the ipc mechanism itself.

[1]: https://goo.gl/JL2tfX
[2]: program to allocate a new binderfs binder device:

 #define _GNU_SOURCE
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 

 int main(int argc, char *argv[])
 {
 int fd, ret, saved_errno;
 size_t len;
 struct binderfs_device device = { 0 };

 if (argc < 2)
 exit(EXIT_FAILURE);

 len = strlen(argv[1]);
 if (len > BINDERFS_MAX_NAME)
 exit(EXIT_FAILURE);

 memcpy(device.name, argv[1], len);

 fd = open("/dev/binderfs/binder-control", O_RDONLY | O_CLOEXEC);
 if (fd < 0) {
 printf("%s - Failed to open binder-control device\n",
strerror(errno));
 exit(EXIT_FAILURE);
 }

 ret = ioctl(fd, BINDER_CTL_ADD, &device);
 saved_errno = errno;
 close(fd);
 errno = saved_errno;
 if (ret < 0) {
 printf("%s - Failed to allocate new binder device\n",
strerror(errno));
 exit(EXIT_FAILURE);
 }

 printf("Allocated new binder device with major %d, minor %d, and "
"name %s\n", device.major, device.minor,
device.name);

 exit(EXIT_SUCCESS);
 }

Cc: Martijn Coenen 
Cc: Greg Kroah-Hartman 
Signed-off-by: Christian Brauner 
Acked-by

Re: [PATCH 3/6] staging: most: sound: rename variable

2018-12-14 Thread kbuild test robot
Hi Christian,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.20-rc6 next-20181214]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Christian-Gromm/staging-most-sound-change-sound-card-layout/20181213-063731


coccinelle warnings: (new ones prefixed by >>)

>> drivers/staging/most/sound/sound.c:673:21-27: ERROR: application of sizeof 
>> to pointer

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: most: sound: fix noderef.cocci warnings

2018-12-14 Thread kbuild test robot
From: kbuild test robot 

drivers/staging/most/sound/sound.c:673:21-27: ERROR: application of sizeof to 
pointer

 sizeof when applied to a pointer typed expression gives the size of
 the pointer

Generated by: scripts/coccinelle/misc/noderef.cocci

Fixes: 58bce1efd0e8 ("staging: most: sound: rename variable")
CC: Christian Gromm 
Signed-off-by: kbuild test robot 
---

url:
https://github.com/0day-ci/linux/commits/Christian-Gromm/staging-most-sound-change-sound-card-layout/20181213-063731

 sound.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/staging/most/sound/sound.c
+++ b/drivers/staging/most/sound/sound.c
@@ -670,7 +670,7 @@ skip_adpt_alloc:
goto err_free_adpt;
 
pcm->private_data = channel;
-   snprintf(pcm->name, sizeof(device_name), device_name);
+   snprintf(pcm->name, sizeof(*device_name), device_name);
snd_pcm_set_ops(pcm, direction, &pcm_ops);
 
if (create) {
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] binder: fix use-after-free due to ksys_close() during fdget()

2018-12-14 Thread Todd Kjos
44d8047f1d8 ("binder: use standard functions to allocate fds")
exposed a pre-existing issue in the binder driver.

fdget() is used in ksys_ioctl() as a performance optimization.
One of the rules associated with fdget() is that ksys_close() must
not be called between the fdget() and the fdput(). There is a case
where this requirement is not met in the binder driver which results
in the reference count dropping to 0 when the device is still in
use. This can result in use-after-free or other issues.

If userpace has passed a file-descriptor for the binder driver using
a BINDER_TYPE_FDA object, then kys_close() is called on it when
handling a binder_ioctl(BC_FREE_BUFFER) command. This violates
the assumptions for using fdget().

The problem is fixed by deferring the fd close using task_work_add()
so ksys_close() is called after returning from binder_ioctl().

Fixes: 44d8047f1d87a ("binder: use standard functions to allocate fds")
Suggested-by: Al Viro 
Signed-off-by: Todd Kjos 
---
v2:
- simplified code

If possible, please add to 4.20-final

 drivers/android/binder.c | 60 ++--
 1 file changed, 58 insertions(+), 2 deletions(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index c525b164d39d2f..5d0233ca852c5d 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -72,6 +72,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -2184,6 +2185,61 @@ static bool binder_validate_fixup(struct binder_buffer 
*b,
return (fixup_offset >= last_min_offset);
 }
 
+/**
+ * struct binder_task_work_cb - for deferred close
+ *
+ * @twork:callback_head for task work
+ * @fd:   fd to close
+ *
+ * Structure to pass task work to be handled after
+ * returning from binder_ioctl() via task_work_add().
+ */
+struct binder_task_work_cb {
+   struct callback_head twork;
+   int fd;
+};
+
+/**
+ * binder_do_fd_close() - close list of file descriptors
+ * @twork: callback head for task work
+ *
+ * It is not safe to call ksys_close() during the binder_ioctl()
+ * function if there is a chance that binder's own file descriptor
+ * might be closed. This is to meet the requirements for using
+ * fdget() (see comments for __fget_light()). Therefore use
+ * task_work_add() to schedule the close operation once we have
+ * returned from binder_ioctl(). This function is a callback
+ * for that mechanism and does the actual ksys_close() on the
+ * given file descriptor.
+ */
+static void binder_do_fd_close(struct callback_head *twork)
+{
+   struct binder_task_work_cb *twcb = container_of(twork,
+   struct binder_task_work_cb, twork);
+
+   ksys_close(twcb->fd);
+   kfree(twcb);
+}
+
+/**
+ * binder_deferred_fd_close() - schedule a close for the given file-descriptor
+ * @fd:file-descriptor to close
+ *
+ * See comments in binder_do_fd_close(). This function is used to schedule
+ * a file-descriptor to be closed after returning from binder_ioctl().
+ */
+static void binder_deferred_fd_close(int fd)
+{
+   struct binder_task_work_cb *twcb;
+
+   twcb = kzalloc(sizeof(*twcb), GFP_KERNEL);
+   if (!twcb)
+   return;
+   init_task_work(&twcb->twork, binder_do_fd_close);
+   twcb->fd = fd;
+   task_work_add(current, &twcb->twork, true);
+}
+
 static void binder_transaction_buffer_release(struct binder_proc *proc,
  struct binder_buffer *buffer,
  binder_size_t *failed_at)
@@ -2323,7 +2379,7 @@ static void binder_transaction_buffer_release(struct 
binder_proc *proc,
}
fd_array = (u32 *)(parent_buffer + 
(uintptr_t)fda->parent_offset);
for (fd_index = 0; fd_index < fda->num_fds; fd_index++)
-   ksys_close(fd_array[fd_index]);
+   binder_deferred_fd_close(fd_array[fd_index]);
} break;
default:
pr_err("transaction release %d bad object type %x\n",
@@ -3942,7 +3998,7 @@ static int binder_apply_fd_fixups(struct 
binder_transaction *t)
} else if (ret) {
u32 *fdp = (u32 *)(t->buffer->data + fixup->offset);
 
-   ksys_close(*fdp);
+   binder_deferred_fd_close(*fdp);
}
list_del(&fixup->fixup_entry);
kfree(fixup);
-- 
2.20.0.405.gbc1bbc6f85-goog

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 04/11] staging: iio: adt7316: fix handling of dac high resolution option

2018-12-14 Thread Jeremy Fertic
On Fri, Dec 14, 2018 at 09:26:18AM +0300, Dan Carpenter wrote:
> On Thu, Dec 13, 2018 at 03:01:46PM -0700, Jeremy Fertic wrote:
> > On Wed, Dec 12, 2018 at 11:23:16AM +0300, Dan Carpenter wrote:
> > > On Tue, Dec 11, 2018 at 05:54:56PM -0700, Jeremy Fertic wrote:
> > > > @@ -651,10 +649,12 @@ static ssize_t 
> > > > adt7316_store_da_high_resolution(struct device *dev,
> > > > u8 config3;
> > > > int ret;
> > > >  
> > > > +   if (chip->id == ID_ADT7318 || chip->id == ID_ADT7519)
> > > > +   return -EPERM;
> > > 
> > > return -EINVAL is more appropriate than -EPERM.
> > > 
> > > regards,
> > > dan carpenter
> > > 
> > 
> > I chose -EPERM because the driver uses it quite a few times in similar
> > circumstances.
> 
> Yeah.  I saw that when I reviewed the later patches in this series.
> 
> It's really not doing it right.  -EPERM means permission checks like
> access_ok() failed so it's not appropriate.  -EINVAL is sort of general
> purpose for invalid commands so it's probably the correct thing.
> 
> > At least with this driver, -EINVAL is used when the user
> > attempts to write data that would never be valid. -EPERM is used when
> > either the current device settings prevent some functionality from being
> > used, or the device never supports that functionality. This patch is the
> > latter, that these two chip ids never support this function.
> > 
> > I'll change to -EINVAL in a v2 series, but I wonder if I should hold off
> > on a separate patch for other instances in this driver since it will be
> > undergoing a substantial refactoring.
> 
> Generally, you should prefer kernel standards over driver standards and
> especially for staging.  But it doesn't matter.  When I reviewed this
> patch, I hadn't seen that the driver was doing it like this but now I
> know so it's fine.  We can clean it all at once later if you want.
> 
> regards,
> dan carpenter
> 

I'll wait to deal with these error values since some of them might go away
with all the changes necessary to get the driver out of staging. Thanks
for clarifying things for me.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/7] staging: olpc_dcon: add a missing dependency

2018-12-14 Thread Arnd Bergmann
From: Lubomir Rintel 

Commit 33f49571d75024b1044cd02689ad2bdb4924cc80 upstream.

  WARNING: unmet direct dependencies detected for BACKLIGHT_CLASS_DEVICE
Depends on [n]: HAS_IOMEM [=y] && BACKLIGHT_LCD_SUPPORT [=n]
Selected by [y]:
- FB_OLPC_DCON [=y] && STAGING [=y] && X86 [=y] && OLPC [=y] && FB [=y]
&& I2C [=y] && (GPIO_CS5535 [=n] || GPIO_CS5535 [=n]=n)

Signed-off-by: Lubomir Rintel 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/staging/olpc_dcon/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/olpc_dcon/Kconfig 
b/drivers/staging/olpc_dcon/Kconfig
index c91a56f77bcb..192cc8d0853f 100644
--- a/drivers/staging/olpc_dcon/Kconfig
+++ b/drivers/staging/olpc_dcon/Kconfig
@@ -2,6 +2,7 @@ config FB_OLPC_DCON
tristate "One Laptop Per Child Display CONtroller support"
depends on OLPC && FB
depends on I2C
+   depends on BACKLIGHT_LCD_SUPPORT
depends on (GPIO_CS5535 || GPIO_CS5535=n)
select BACKLIGHT_CLASS_DEVICE
help
-- 
2.20.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] binder: fix use-after-free due to ksys_close() during fdget()

2018-12-14 Thread Al Viro
On Fri, Dec 14, 2018 at 12:38:15PM -0800, Todd Kjos wrote:
> 44d8047f1d8 ("binder: use standard functions to allocate fds")
> exposed a pre-existing issue in the binder driver.
> 
> fdget() is used in ksys_ioctl() as a performance optimization.
> One of the rules associated with fdget() is that ksys_close() must
> not be called between the fdget() and the fdput(). There is a case
> where this requirement is not met in the binder driver which results
> in the reference count dropping to 0 when the device is still in
> use. This can result in use-after-free or other issues.
> 
> If userpace has passed a file-descriptor for the binder driver using
> a BINDER_TYPE_FDA object, then kys_close() is called on it when
> handling a binder_ioctl(BC_FREE_BUFFER) command. This violates
> the assumptions for using fdget().
> 
> The problem is fixed by deferring the fd close using task_work_add()
> so ksys_close() is called after returning from binder_ioctl().
> 
> Fixes: 44d8047f1d87a ("binder: use standard functions to allocate fds")
> Suggested-by: Al Viro 
> Signed-off-by: Todd Kjos 

Umm...  IMO you are making it more brittle than needed.  Descriptors
(as in, integers serving as indices in file descriptor tables) are
sensitive to a lot of things and generally you don't want to pass
them around, at least not without a lot more context than you do.

References to struct file are much more robust.  And frankly, ksys_close()
is best not touched - what you want is basically a version of __close_fd()
that would grab a reference to struct file before filp_close() and
passed that reference to you.  Then your delayed ksys_close() would turn
into (equally delayed) fput().

Something like
int rip_fd(int fd, struct file **res)
{
struct files_struct *files = current->files;
struct file *file;
struct fdtable *fdt;

spin_lock(&files->file_lock);
fdt = files_fdtable(files);
if (fd >= fdt->max_fds)
goto out_unlock;
file = fdt->fd[fd];
if (!file)
goto out_unlock;
rcu_assign_pointer(fdt->fd[fd], NULL);
__put_unused_fd(files, fd);
spin_unlock(&files->file_lock);
get_file(file);
*res = file;
return filp_close(file, files);

out_unlock:
spin_unlock(&files->file_lock);
*res = NULL;
return -ENOENT;
}

used as
error = rip_fd(fd, &file);
/* we are committed to arranging fput(file) now, error or not */

Frankly, the main objection to exporting that would be to avoid encouraging
the "we'll just pass the number around" kind of braindamage.  In case of
binder you are locked into that braindamage by an atrocious userland API
design and warnings along the lines of "use that and you *will* have
to explain yourself; yes, we will be watching" might suffice to prevent
additional uses...
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 02/12] gpu: ipu-csi: Swap fields according to input/output field types

2018-12-14 Thread Steve Longerbeam




On 12/13/18 4:59 AM, Philipp Zabel wrote:

Hi Steve,

On Tue, 2018-10-16 at 17:00 -0700, Steve Longerbeam wrote:

The function ipu_csi_init_interface() was inverting the F-bit for
NTSC case, in the CCIR_CODE_1/2 registers. The result being that
for NTSC bottom-top field order, the CSI would swap fields and
capture in top-bottom order.

Instead, base field swap on the field order of the input to the CSI,
and the field order of the requested output. If the input/output
fields are sequential but different, swap fields, otherwise do
not swap. This requires passing both the input and output mbus
frame formats to ipu_csi_init_interface().

Move this code to a new private function ipu_csi_set_bt_interlaced_codes()
that programs the CCIR_CODE_1/2 registers for interlaced BT.656 (and
possibly interlaced BT.1120 in the future).

When detecting input video standard from the input frame width/height,
make sure to double height if input field type is alternate, since
in that case input height only includes lines for one field.

Signed-off-by: Steve Longerbeam 
---
Changes since v4:
- Cleaned up some convoluted code in ipu_csi_init_interface(), suggested
   by Philipp Zabel.
- Fixed a regression in csi_setup(), caught by Philipp.
---
  drivers/gpu/ipu-v3/ipu-csi.c  | 119 +++---
  drivers/staging/media/imx/imx-media-csi.c |  17 +---
  include/video/imx-ipu-v3.h|   3 +-
  3 files changed, 88 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c
index aa0e30a2ba18..4a15e513fa05 100644
--- a/drivers/gpu/ipu-v3/ipu-csi.c
+++ b/drivers/gpu/ipu-v3/ipu-csi.c
@@ -325,6 +325,15 @@ static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config 
*cfg, u32 mbus_code,
return 0;
  }
  
+/* translate alternate field mode based on given standard */

+static inline enum v4l2_field
+ipu_csi_translate_field(enum v4l2_field field, v4l2_std_id std)
+{
+   return (field != V4L2_FIELD_ALTERNATE) ? field :
+   ((std & V4L2_STD_525_60) ?
+V4L2_FIELD_SEQ_BT : V4L2_FIELD_SEQ_TB);
+}
+
  /*
   * Fill a CSI bus config struct from mbus_config and mbus_framefmt.
   */
@@ -374,22 +383,75 @@ static int fill_csi_bus_cfg(struct ipu_csi_bus_config 
*csicfg,
return 0;
  }
  
+static int ipu_csi_set_bt_interlaced_codes(struct ipu_csi *csi,

+  struct v4l2_mbus_framefmt *infmt,
+  struct v4l2_mbus_framefmt *outfmt,

infmt and outfmt parameters could be const.


Agreed, I will convert these pointer args to const. And since we are 
changing the API to ipu_csi_init_interface() anyway, I went ahead and 
converted the mbus_cfg, infmt, and outfmt pointer args to const there as 
well.




+  v4l2_std_id std)
+{
+   enum v4l2_field infield, outfield;
+   bool swap_fields;
+
+   /* get translated field type of input and output */
+   infield = ipu_csi_translate_field(infmt->field, std);
+   outfield = ipu_csi_translate_field(outfmt->field, std);
+
+   /*
+* Write the H-V-F codes the CSI will match against the
+* incoming data for start/end of active and blanking
+* field intervals. If input and output field types are
+* sequential but not the same (one is SEQ_BT and the other
+* is SEQ_TB), swap the F-bit so that the CSI will capture
+* field 1 lines before field 0 lines.
+*/
+   swap_fields = (V4L2_FIELD_IS_SEQUENTIAL(infield) &&
+  V4L2_FIELD_IS_SEQUENTIAL(outfield) &&
+  infield != outfield);
+
+   if (!swap_fields) {
+   /*
+* Field0BlankEnd  = 110, Field0BlankStart  = 010
+* Field0ActiveEnd = 100, Field0ActiveStart = 000
+* Field1BlankEnd  = 111, Field1BlankStart  = 011
+* Field1ActiveEnd = 101, Field1ActiveStart = 001
+*/
+   ipu_csi_write(csi, 0x40596 | CSI_CCIR_ERR_DET_EN,
+ CSI_CCIR_CODE_1);
+   ipu_csi_write(csi, 0xD07DF, CSI_CCIR_CODE_2);
+   } else {
+   dev_dbg(csi->ipu->dev, "capture field swap\n");
+
+   /* same as above but with F-bit inverted */
+   ipu_csi_write(csi, 0xD07DF | CSI_CCIR_ERR_DET_EN,
+ CSI_CCIR_CODE_1);
+   ipu_csi_write(csi, 0x40596, CSI_CCIR_CODE_2);
+   }
+
+   ipu_csi_write(csi, 0xFF, CSI_CCIR_CODE_3);
+
+   return 0;
+}
+
+
  int ipu_csi_init_interface(struct ipu_csi *csi,
   struct v4l2_mbus_config *mbus_cfg,
-  struct v4l2_mbus_framefmt *mbus_fmt)
+  struct v4l2_mbus_framefmt *infmt,
+  struct v4l2_mbus_framefmt *outfmt)
  {
struct ipu_csi_bus_config cfg;
unsigned long flags;
u32 width, height,

[PATCH v6] gpu: ipu-csi: Swap fields according to input/output field types

2018-12-14 Thread Steve Longerbeam
The function ipu_csi_init_interface() was inverting the F-bit for
NTSC case, in the CCIR_CODE_1/2 registers. The result being that
for NTSC bottom-top field order, the CSI would swap fields and
capture in top-bottom order.

Instead, base field swap on the field order of the input to the CSI,
and the field order of the requested output. If the input/output
fields are sequential but different, swap fields, otherwise do
not swap. This requires passing both the input and output mbus
frame formats to ipu_csi_init_interface().

Move this code to a new private function ipu_csi_set_bt_interlaced_codes()
that programs the CCIR_CODE_1/2 registers for interlaced BT.656 (and
possibly interlaced BT.1120 in the future).

When detecting input video standard from the input frame width/height,
make sure to double height if input field type is alternate, since
in that case input height only includes lines for one field.

Signed-off-by: Steve Longerbeam 
Reviewed-by: Philipp Zabel 
---
Changes since v5:
- Convert to const the infmt, outfmt, and mbus_cfg pointer args to
  ipu_csi_init_interface(), suggested by Philipp Zabel.
- Bring back if_fmt local var and don't copy outfmt to local stack in
  csi_setup(), suggested by Philipp.

Changes since v4:
- Cleaned up some convoluted code in ipu_csi_init_interface(), suggested
  by Philipp.
- Fixed a regression in csi_setup(), caught by Philipp.
---
 drivers/gpu/ipu-v3/ipu-csi.c  | 126 +++---
 drivers/staging/media/imx/imx-media-csi.c |   7 +-
 include/video/imx-ipu-v3.h|   5 +-
 3 files changed, 89 insertions(+), 49 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c
index aa0e30a2ba18..d1e575571a8d 100644
--- a/drivers/gpu/ipu-v3/ipu-csi.c
+++ b/drivers/gpu/ipu-v3/ipu-csi.c
@@ -325,12 +325,21 @@ static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config 
*cfg, u32 mbus_code,
return 0;
 }
 
+/* translate alternate field mode based on given standard */
+static inline enum v4l2_field
+ipu_csi_translate_field(enum v4l2_field field, v4l2_std_id std)
+{
+   return (field != V4L2_FIELD_ALTERNATE) ? field :
+   ((std & V4L2_STD_525_60) ?
+V4L2_FIELD_SEQ_BT : V4L2_FIELD_SEQ_TB);
+}
+
 /*
  * Fill a CSI bus config struct from mbus_config and mbus_framefmt.
  */
 static int fill_csi_bus_cfg(struct ipu_csi_bus_config *csicfg,
-struct v4l2_mbus_config *mbus_cfg,
-struct v4l2_mbus_framefmt *mbus_fmt)
+   const struct v4l2_mbus_config *mbus_cfg,
+   const struct v4l2_mbus_framefmt *mbus_fmt)
 {
int ret;
 
@@ -374,22 +383,76 @@ static int fill_csi_bus_cfg(struct ipu_csi_bus_config 
*csicfg,
return 0;
 }
 
+static int
+ipu_csi_set_bt_interlaced_codes(struct ipu_csi *csi,
+   const struct v4l2_mbus_framefmt *infmt,
+   const struct v4l2_mbus_framefmt *outfmt,
+   v4l2_std_id std)
+{
+   enum v4l2_field infield, outfield;
+   bool swap_fields;
+
+   /* get translated field type of input and output */
+   infield = ipu_csi_translate_field(infmt->field, std);
+   outfield = ipu_csi_translate_field(outfmt->field, std);
+
+   /*
+* Write the H-V-F codes the CSI will match against the
+* incoming data for start/end of active and blanking
+* field intervals. If input and output field types are
+* sequential but not the same (one is SEQ_BT and the other
+* is SEQ_TB), swap the F-bit so that the CSI will capture
+* field 1 lines before field 0 lines.
+*/
+   swap_fields = (V4L2_FIELD_IS_SEQUENTIAL(infield) &&
+  V4L2_FIELD_IS_SEQUENTIAL(outfield) &&
+  infield != outfield);
+
+   if (!swap_fields) {
+   /*
+* Field0BlankEnd  = 110, Field0BlankStart  = 010
+* Field0ActiveEnd = 100, Field0ActiveStart = 000
+* Field1BlankEnd  = 111, Field1BlankStart  = 011
+* Field1ActiveEnd = 101, Field1ActiveStart = 001
+*/
+   ipu_csi_write(csi, 0x40596 | CSI_CCIR_ERR_DET_EN,
+ CSI_CCIR_CODE_1);
+   ipu_csi_write(csi, 0xD07DF, CSI_CCIR_CODE_2);
+   } else {
+   dev_dbg(csi->ipu->dev, "capture field swap\n");
+
+   /* same as above but with F-bit inverted */
+   ipu_csi_write(csi, 0xD07DF | CSI_CCIR_ERR_DET_EN,
+ CSI_CCIR_CODE_1);
+   ipu_csi_write(csi, 0x40596, CSI_CCIR_CODE_2);
+   }
+
+   ipu_csi_write(csi, 0xFF, CSI_CCIR_CODE_3);
+
+   return 0;
+}
+
+
 int ipu_csi_init_interface(struct ipu_csi *csi,
-  struct v4l2_mbus_config *mbus_cfg,
-  struct v4l2_mbus_framefmt *mbus_fmt)
+   

[PATCH v3] binder: fix use-after-free due to ksys_close() during fdget()

2018-12-14 Thread Todd Kjos
44d8047f1d8 ("binder: use standard functions to allocate fds")
exposed a pre-existing issue in the binder driver.

fdget() is used in ksys_ioctl() as a performance optimization.
One of the rules associated with fdget() is that ksys_close() must
not be called between the fdget() and the fdput(). There is a case
where this requirement is not met in the binder driver which results
in the reference count dropping to 0 when the device is still in
use. This can result in use-after-free or other issues.

If userpace has passed a file-descriptor for the binder driver using
a BINDER_TYPE_FDA object, then kys_close() is called on it when
handling a binder_ioctl(BC_FREE_BUFFER) command. This violates
the assumptions for using fdget().

The problem is fixed by deferring the close using task_work_add(). A
new variant of __close_fd() was created that returns a struct file
with a reference. The fput() is deferred instead of using ksys_close().

Fixes: 44d8047f1d87a ("binder: use standard functions to allocate fds")
Suggested-by: Al Viro 
Signed-off-by: Todd Kjos 
---
v2:
- simplified code
v3:
- implemented Al Viro's suggestion to pass struct file instead of fd
- added __close_fd_get_file() to close the fd, but reference the file

 drivers/android/binder.c | 63 ++--
 fs/file.c| 29 ++
 include/linux/fdtable.h  |  1 +
 3 files changed, 91 insertions(+), 2 deletions(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index c525b164d39d2f..c4ee11d883dd93 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -72,6 +72,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -2184,6 +2185,64 @@ static bool binder_validate_fixup(struct binder_buffer 
*b,
return (fixup_offset >= last_min_offset);
 }
 
+/**
+ * struct binder_task_work_cb - for deferred close
+ *
+ * @twork:callback_head for task work
+ * @fd:   fd to close
+ *
+ * Structure to pass task work to be handled after
+ * returning from binder_ioctl() via task_work_add().
+ */
+struct binder_task_work_cb {
+   struct callback_head twork;
+   struct file *file;
+};
+
+/**
+ * binder_do_fd_close() - close list of file descriptors
+ * @twork: callback head for task work
+ *
+ * It is not safe to call ksys_close() during the binder_ioctl()
+ * function if there is a chance that binder's own file descriptor
+ * might be closed. This is to meet the requirements for using
+ * fdget() (see comments for __fget_light()). Therefore use
+ * task_work_add() to schedule the close operation once we have
+ * returned from binder_ioctl(). This function is a callback
+ * for that mechanism and does the actual ksys_close() on the
+ * given file descriptor.
+ */
+static void binder_do_fd_close(struct callback_head *twork)
+{
+   struct binder_task_work_cb *twcb = container_of(twork,
+   struct binder_task_work_cb, twork);
+
+   fput(twcb->file);
+   kfree(twcb);
+}
+
+/**
+ * binder_deferred_fd_close() - schedule a close for the given file-descriptor
+ * @fd:file-descriptor to close
+ *
+ * See comments in binder_do_fd_close(). This function is used to schedule
+ * a file-descriptor to be closed after returning from binder_ioctl().
+ */
+static void binder_deferred_fd_close(int fd)
+{
+   struct binder_task_work_cb *twcb;
+
+   twcb = kzalloc(sizeof(*twcb), GFP_KERNEL);
+   if (!twcb)
+   return;
+   init_task_work(&twcb->twork, binder_do_fd_close);
+   __close_fd_get_file(fd, &twcb->file);
+   if (twcb->file)
+   task_work_add(current, &twcb->twork, true);
+   else
+   kfree(twcb);
+}
+
 static void binder_transaction_buffer_release(struct binder_proc *proc,
  struct binder_buffer *buffer,
  binder_size_t *failed_at)
@@ -2323,7 +2382,7 @@ static void binder_transaction_buffer_release(struct 
binder_proc *proc,
}
fd_array = (u32 *)(parent_buffer + 
(uintptr_t)fda->parent_offset);
for (fd_index = 0; fd_index < fda->num_fds; fd_index++)
-   ksys_close(fd_array[fd_index]);
+   binder_deferred_fd_close(fd_array[fd_index]);
} break;
default:
pr_err("transaction release %d bad object type %x\n",
@@ -3942,7 +4001,7 @@ static int binder_apply_fd_fixups(struct 
binder_transaction *t)
} else if (ret) {
u32 *fdp = (u32 *)(t->buffer->data + fixup->offset);
 
-   ksys_close(*fdp);
+   binder_deferred_fd_close(*fdp);
}
list_del(&fixup->fixup_entry);
kfree(fixup);
diff --git a/fs/file.c b/fs/file.c
index 7ffd6e9d103d64..8d059d8973e9fc 100644

[PATCH] staging: wilc1000: fix NULL dereference inside wilc_scan()

2018-12-14 Thread Ajay.Kathat
From: Ajay Singh 

Added NULL check before accessing 'hidden_net' pointer inside
wilc_scan() to fix the issue found by static code checker.

Fixes: 8f1a0ac1eba7 ("staging: wilc1000: handle scan operation callback from 
cfg80211 context")
Reported-by: Dan Carpenter 
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 48 +--
 1 file changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index b8603f2..70c854d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -246,27 +246,29 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 
scan_type,
 
hif_drv->usr_scan_req.ch_cnt = 0;
 
-   wid_list[index].id = WID_SSID_PROBE_REQ;
-   wid_list[index].type = WID_STR;
-
-   for (i = 0; i < hidden_net->n_ssids; i++)
-   valuesize += ((hidden_net->net_info[i].ssid_len) + 1);
-   hdn_ntwk_wid_val = kmalloc(valuesize + 1, GFP_KERNEL);
-   wid_list[index].val = hdn_ntwk_wid_val;
-   if (wid_list[index].val) {
-   buffer = wid_list[index].val;
-
-   *buffer++ = hidden_net->n_ssids;
-
-   for (i = 0; i < hidden_net->n_ssids; i++) {
-   *buffer++ = hidden_net->net_info[i].ssid_len;
-   memcpy(buffer, hidden_net->net_info[i].ssid,
-  hidden_net->net_info[i].ssid_len);
-   buffer += hidden_net->net_info[i].ssid_len;
-   }
+   if (hidden_net) {
+   wid_list[index].id = WID_SSID_PROBE_REQ;
+   wid_list[index].type = WID_STR;
+
+   for (i = 0; i < hidden_net->n_ssids; i++)
+   valuesize += ((hidden_net->net_info[i].ssid_len) + 1);
+   hdn_ntwk_wid_val = kmalloc(valuesize + 1, GFP_KERNEL);
+   wid_list[index].val = hdn_ntwk_wid_val;
+   if (wid_list[index].val) {
+   buffer = wid_list[index].val;
+
+   *buffer++ = hidden_net->n_ssids;
+
+   for (i = 0; i < hidden_net->n_ssids; i++) {
+   *buffer++ = hidden_net->net_info[i].ssid_len;
+   memcpy(buffer, hidden_net->net_info[i].ssid,
+  hidden_net->net_info[i].ssid_len);
+   buffer += hidden_net->net_info[i].ssid_len;
+   }
 
-   wid_list[index].size = (s32)(valuesize + 1);
-   index++;
+   wid_list[index].size = (s32)(valuesize + 1);
+   index++;
+   }
}
 
wid_list[index].id = WID_INFO_ELEMENT_PROBE;
@@ -316,8 +318,10 @@ int wilc_scan(struct wilc_vif *vif, u8 scan_source, u8 
scan_type,
  jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT));
 
 error:
-   kfree(hidden_net->net_info);
-   kfree(hdn_ntwk_wid_val);
+   if (hidden_net) {
+   kfree(hidden_net->net_info);
+   kfree(hdn_ntwk_wid_val);
+   }
 
return result;
 }
-- 
2.7.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel