[PATCH] staging: vc04_services: Remove unused vchiq_genversion script

2018-09-21 Thread Tuomas Tynkkynen
As far as I can tell, this has never been used.

Signed-off-by: Tuomas Tynkkynen 
---
 .../interface/vchiq_arm/vchiq_genversion   | 88 --
 1 file changed, 88 deletions(-)
 delete mode 100644 
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_genversion

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_genversion 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_genversion
deleted file mode 100644
index dd1f324a8654..
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_genversion
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/perl -w
-# SPDX-License-Identifier: GPL-2.0
-
-use strict;
-
-#
-# Generate a version from available information
-#
-
-my $prefix = shift @ARGV;
-my $root = shift @ARGV;
-
-
-if ( not defined $root ) {
-   die "usage: $0 prefix root-dir\n";
-}
-
-if ( ! -d $root ) {
-   die "root directory $root not found\n";
-}
-
-my $version = "unknown";
-my $tainted = "";
-
-if ( -d "$root/.git" ) {
-   # attempt to work out git version. only do so
-   # on a linux build host, as cygwin builds are
-   # already slow enough
-
-   if ( -f "/usr/bin/git" || -f "/usr/local/bin/git" ) {
-   if (not open(F, "git --git-dir $root/.git rev-parse --verify 
HEAD|")) {
-   $version = "no git version";
-   }
-   else {
-   $version = ;
-   $version =~ s/[ \r\n]*$//; # chomp may not be 
enough (cygwin).
-   $version =~ s/^[ \r\n]*//; # chomp may not be 
enough (cygwin).
-   }
-
-   if (open(G, "git --git-dir $root/.git status --porcelain|")) {
-   $tainted = ;
-   $tainted =~ s/[ \r\n]*$//; # chomp may not be 
enough (cygwin).
-   $tainted =~ s/^[ \r\n]*//; # chomp may not be 
enough (cygwin).
-   if (length $tainted) {
-   $version = join ' ', $version, "(tainted)";
-   }
-   else {
-   $version = join ' ', $version, "(clean)";
- }
-   }
-   }
-}
-
-my $hostname = `hostname`;
-$hostname =~ s/[ \r\n]*$//; # chomp may not be enough (cygwin).
-$hostname =~ s/^[ \r\n]*//; # chomp may not be enough (cygwin).
-
-
-print STDERR "Version $version\n";
-print <
-
-VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_hostname, "$hostname" );
-VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_version, "$version" );
-VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_time,__TIME__ );
-VC_DEBUG_DECLARE_STRING_VAR( ${prefix}_build_date,__DATE__ );
-
-const char *vchiq_get_build_hostname( void )
-{
-   return vchiq_build_hostname;
-}
-
-const char *vchiq_get_build_version( void )
-{
-   return vchiq_build_version;
-}
-
-const char *vchiq_get_build_date( void )
-{
-   return vchiq_build_date;
-}
-
-const char *vchiq_get_build_time( void )
-{
-   return vchiq_build_time;
-}
-EOF
-- 
2.16.3

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


[PATCH 1/7] staging: vc04_services: Drop pointless stub functions

2018-10-04 Thread Tuomas Tynkkynen
These functions do nothing besides returning NULL and are unused.
Just drop them.

Signed-off-by: Tuomas Tynkkynen 
---
 .../vc04_services/interface/vchi/vchi.h   | 11 
 .../interface/vchiq_arm/vchiq_shim.c  | 27 ---
 2 files changed, 38 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 3fe19d72b3ab..392c78200e9d 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -116,9 +116,6 @@ typedef struct service_info_tag {
 extern "C" {
 #endif
 
-extern /*@observer@*/ VCHI_CONNECTION_T *vchi_create_connection(const 
VCHI_CONNECTION_API_T *function_table,
-const 
VCHI_MESSAGE_DRIVER_T *low_level);
-
 // Routine used to initialise the vchi on both local + remote connections
 extern int32_t vchi_initialise(VCHI_INSTANCE_T *instance_handle);
 
@@ -292,14 +289,6 @@ extern int32_t 
vchi_bulk_queue_transmit(VCHI_SERVICE_HANDLE_T handle,
  Configuration plumbing
  */
 
-// function prototypes for the different mid layers (the state info gives the 
different physical connections)
-extern const VCHI_CONNECTION_API_T *single_get_func_table(void);
-//extern const VCHI_CONNECTION_API_T *local_server_get_func_table(void);
-//extern const VCHI_CONNECTION_API_T *local_client_get_func_table(void);
-
-// declare all message drivers here
-const VCHI_MESSAGE_DRIVER_T *vchi_mphi_message_driver_func_table(void);
-
 #ifdef __cplusplus
 }
 #endif
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 dddc828390d0..9235a974dae4 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -50,33 +50,6 @@ struct shim_service {
void *callback_param;
 };
 
-/* --
- * return pointer to the mphi message driver function table
- *  */
-const VCHI_MESSAGE_DRIVER_T *
-vchi_mphi_message_driver_func_table(void)
-{
-   return NULL;
-}
-
-/* --
- * return a pointer to the 'single' connection driver fops
- *  */
-const VCHI_CONNECTION_API_T *
-single_get_func_table(void)
-{
-   return NULL;
-}
-
-VCHI_CONNECTION_T *vchi_create_connection(
-   const VCHI_CONNECTION_API_T *function_table,
-   const VCHI_MESSAGE_DRIVER_T *low_level)
-{
-   (void)function_table;
-   (void)low_level;
-   return NULL;
-}
-
 /***
  * Name: vchi_msg_peek
  *
-- 
2.18.0

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


[PATCH 2/7] staging: vc04_services: Drop 'connection' field from SERVICE_CREATION_T

2018-10-04 Thread Tuomas Tynkkynen
The connection field of SERVICE_CREATION_T is assigned to but its value
is never read. Drop the field and the resulting no longer needed code
from bcm2835-audio and bcm2835-camera.

Signed-off-by: Tuomas Tynkkynen 
---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 3 ---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835.h   | 1 -
 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c   | 2 --
 drivers/staging/vc04_services/interface/vchi/vchi.h | 1 -
 4 files changed, 7 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 0bdaea1fdd77..6ec15e44d7e2 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -125,13 +125,11 @@ static void audio_vchi_callback(void *param,
 
 static int
 vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance,
-  VCHI_CONNECTION_T *vchi_connection,
   struct bcm2835_audio_instance *instance)
 {
SERVICE_CREATION_T params = {
.version= VCHI_VERSION_EX(VC_AUDIOSERV_VER, 
VC_AUDIOSERV_MIN_VER),
.service_id = VC_AUDIO_SERVER_NAME,
-   .connection = vchi_connection,
.rx_fifo_size   = 0,
.tx_fifo_size   = 0,
.callback   = audio_vchi_callback,
@@ -228,7 +226,6 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream 
*alsa_stream)
alsa_stream->instance = instance;
 
err = vc_vchi_audio_init(vchi_ctx->vchi_instance,
-vchi_ctx->vchi_connection,
 instance);
if (err < 0)
goto free_instance;
diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
index e13435d1c205..34a0125ce646 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
@@ -45,7 +45,6 @@ enum snd_bcm2835_ctrl {
 
 struct bcm2835_vchi_ctx {
VCHI_INSTANCE_T vchi_instance;
-   VCHI_CONNECTION_T *vchi_connection;
 };
 
 /* definition of the chip-specific record */
diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
index 6e5c1d4ee122..e234b95b61c0 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
@@ -1802,12 +1802,10 @@ int vchiq_mmal_init(struct vchiq_mmal_instance 
**out_instance)
 {
int status;
struct vchiq_mmal_instance *instance;
-   static VCHI_CONNECTION_T *vchi_connection;
static VCHI_INSTANCE_T vchi_instance;
SERVICE_CREATION_T params = {
.version= VCHI_VERSION_EX(VC_MMAL_VER, 
VC_MMAL_MIN_VER),
.service_id = VC_MMAL_SERVER_NAME,
-   .connection = vchi_connection,
.rx_fifo_size   = 0,
.tx_fifo_size   = 0,
.callback   = service_callback,
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 392c78200e9d..1ea997c658f9 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -77,7 +77,6 @@ typedef struct {
 typedef struct {
struct vchi_version version;
int32_t service_id;
-   VCHI_CONNECTION_T *connection;
uint32_t rx_fifo_size;
uint32_t tx_fifo_size;
VCHI_CALLBACK_T callback;
-- 
2.18.0

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


[PATCH 5/7] staging: vc04_services: Drop VCHI_SERVICE_INIT and SERVICE_INFO_T

2018-10-04 Thread Tuomas Tynkkynen
These types are not used anywhere, remove them.

Signed-off-by: Tuomas Tynkkynen 
---
 drivers/staging/vc04_services/interface/vchi/vchi.h | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 103d67024335..5c5bb6ddd9ce 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -87,15 +87,6 @@ typedef struct opaque_vchi_instance_handle_t 
*VCHI_INSTANCE_T;
 // Opaque handle for a server or client
 typedef struct opaque_vchi_service_handle_t *VCHI_SERVICE_HANDLE_T;
 
-// Service registration & startup
-typedef void (*VCHI_SERVICE_INIT)(VCHI_INSTANCE_T initialise_instance, 
VCHI_CONNECTION_T **connections, uint32_t num_connections);
-
-typedef struct service_info_tag {
-   const char * const vll_filename; /* VLL to load to start this service. This 
is an empty string if VLL is "static" */
-   VCHI_SERVICE_INIT init;  /* Service initialisation function */
-   void *vll_handle;/* VLL handle; NULL when unloaded or a 
"static VLL" in build */
-} SERVICE_INFO_T;
-
 /**
  Global funcs - implementation is specific to which side you are on (local / 
remote)
  */
-- 
2.18.0

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


[PATCH 4/7] staging: vc04_services: Drop declaration of vchi_crc_control()

2018-10-04 Thread Tuomas Tynkkynen
There is no definition for this unused function, so drop its prototype.

Signed-off-by: Tuomas Tynkkynen 
---
 drivers/staging/vc04_services/interface/vchi/vchi.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 347825329ea4..103d67024335 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -117,10 +117,6 @@ extern int32_t vchi_connect(VCHI_CONNECTION_T 
**connections,
 //Bulk transfers can remain 'queued'
 extern int32_t vchi_disconnect(VCHI_INSTANCE_T instance_handle);
 
-// Global control over bulk CRC checking
-extern int32_t vchi_crc_control(VCHI_CONNECTION_T *connection,
-   VCHI_CRC_CONTROL_T control);
-
 // helper functions
 extern void *vchi_allocate_buffer(VCHI_SERVICE_HANDLE_T handle, uint32_t 
*length);
 extern void vchi_free_buffer(VCHI_SERVICE_HANDLE_T handle, void *address);
-- 
2.18.0

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


[PATCH 0/7] staging: vc04_services: Some dead code removal

2018-10-04 Thread Tuomas Tynkkynen
Drop various pieces of dead code from here and there to get rid of
the remaining users of VCHI_CONNECTION_T. After that we get to drop
entire header files worth of unused code.

I've tested on a Raspberry Pi Model B (bcm2835_defconfig) that
snd-bcm2835 can still play analog audio just fine.

Tuomas Tynkkynen (7):
  staging: vc04_services: Drop pointless stub functions
  staging: vc04_services: Drop 'connection' field from
SERVICE_CREATION_T
  staging: vc04_services: Drop trivially unused fields from
SERVICE_CREATION_T
  staging: vc04_services: Drop declaration of vchi_crc_control()
  staging: vc04_services: Drop VCHI_SERVICE_INIT and SERVICE_INFO_T
  staging: vc04_services: Drop unused parameters from vchi_connect()
  staging: vc04_services: Drop no longer needed headers

 .../bcm2835-audio/bcm2835-vchiq.c |  10 +-
 .../vc04_services/bcm2835-audio/bcm2835.h |   1 -
 .../vc04_services/bcm2835-camera/mmal-vchiq.c |   9 +-
 .../interface/vchi/connections/connection.h   | 324 --
 .../interface/vchi/message_drivers/message.h  | 196 ---
 .../vc04_services/interface/vchi/vchi.h   |  41 +--
 .../interface/vchi/vchi_cfg_internal.h|  71 
 .../interface/vchiq_arm/vchiq_shim.c  |  38 +-
 8 files changed, 5 insertions(+), 685 deletions(-)
 delete mode 100644 
drivers/staging/vc04_services/interface/vchi/connections/connection.h
 delete mode 100644 
drivers/staging/vc04_services/interface/vchi/message_drivers/message.h
 delete mode 100644 
drivers/staging/vc04_services/interface/vchi/vchi_cfg_internal.h

-- 
2.18.0

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


[PATCH 6/7] staging: vc04_services: Drop unused parameters from vchi_connect()

2018-10-04 Thread Tuomas Tynkkynen
Remove two parameters which are never used and all where all callers
just pass in dummy values anyway.

Signed-off-by: Tuomas Tynkkynen 
---
 .../vc04_services/bcm2835-audio/bcm2835-vchiq.c   |  2 +-
 .../staging/vc04_services/bcm2835-camera/mmal-vchiq.c |  2 +-
 drivers/staging/vc04_services/interface/vchi/vchi.h   |  4 +---
 .../vc04_services/interface/vchiq_arm/vchiq_shim.c| 11 ++-
 4 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index bc48a74a6be6..781754f36da7 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -183,7 +183,7 @@ int bcm2835_new_vchi_ctx(struct device *dev, struct 
bcm2835_vchi_ctx *vchi_ctx)
return -EIO;
}
 
-   ret = vchi_connect(NULL, 0, vchi_ctx->vchi_instance);
+   ret = vchi_connect(vchi_ctx->vchi_instance);
if (ret) {
dev_dbg(dev, "failed to connect VCHI instance (ret=%d)\n",
ret);
diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
index 074a4acc196d..cc2d9933b969 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
@@ -1831,7 +1831,7 @@ int vchiq_mmal_init(struct vchiq_mmal_instance 
**out_instance)
return -EIO;
}
 
-   status = vchi_connect(NULL, 0, vchi_instance);
+   status = vchi_connect(vchi_instance);
if (status) {
pr_err("Failed to connect VCHI instance (status=%d)\n", status);
return -EIO;
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 5c5bb6ddd9ce..95d9da078f46 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -100,9 +100,7 @@ extern int32_t vchi_initialise(VCHI_INSTANCE_T 
*instance_handle);
 
 extern int32_t vchi_exit(void);
 
-extern int32_t vchi_connect(VCHI_CONNECTION_T **connections,
-   const uint32_t num_connections,
-   VCHI_INSTANCE_T instance_handle);
+extern int32_t vchi_connect(VCHI_INSTANCE_T instance_handle);
 
 //When this is called, ensure that all services have no data pending.
 //Bulk transfers can remain 'queued'
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 9235a974dae4..c3223fcdaf87 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -490,9 +490,7 @@ EXPORT_SYMBOL(vchi_initialise);
 /***
  * Name: vchi_connect
  *
- * Arguments: VCHI_CONNECTION_T **connections
- *const uint32_t num_connections
- *VCHI_INSTANCE_T instance_handle)
+ * Arguments: VCHI_INSTANCE_T instance_handle
  *
  * Description: Starts the command service on each connection,
  *  causing INIT messages to be pinged back and forth
@@ -500,15 +498,10 @@ EXPORT_SYMBOL(vchi_initialise);
  * Returns: 0 if successful, failure otherwise
  *
  ***/
-int32_t vchi_connect(VCHI_CONNECTION_T **connections,
-   const uint32_t num_connections,
-   VCHI_INSTANCE_T instance_handle)
+int32_t vchi_connect(VCHI_INSTANCE_T instance_handle)
 {
VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle;
 
-   (void)connections;
-   (void)num_connections;
-
return vchiq_connect(instance);
 }
 EXPORT_SYMBOL(vchi_connect);
-- 
2.18.0

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


[PATCH 3/7] staging: vc04_services: Drop trivially unused fields from SERVICE_CREATION_T

2018-10-04 Thread Tuomas Tynkkynen
These fields are only initialized with constants and never read. Drop
them.

Signed-off-by: Tuomas Tynkkynen 
---
 .../vc04_services/bcm2835-audio/bcm2835-vchiq.c   |  5 -
 .../staging/vc04_services/bcm2835-camera/mmal-vchiq.c |  5 -
 drivers/staging/vc04_services/interface/vchi/vchi.h   | 11 ---
 3 files changed, 21 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 6ec15e44d7e2..bc48a74a6be6 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -130,13 +130,8 @@ vc_vchi_audio_init(VCHI_INSTANCE_T vchi_instance,
SERVICE_CREATION_T params = {
.version= VCHI_VERSION_EX(VC_AUDIOSERV_VER, 
VC_AUDIOSERV_MIN_VER),
.service_id = VC_AUDIO_SERVER_NAME,
-   .rx_fifo_size   = 0,
-   .tx_fifo_size   = 0,
.callback   = audio_vchi_callback,
.callback_param = instance,
-   .want_unaligned_bulk_rx = 1, //TODO: remove VCOS_FALSE
-   .want_unaligned_bulk_tx = 1, //TODO: remove VCOS_FALSE
-   .want_crc   = 0
};
int status;
 
diff --git a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
index e234b95b61c0..074a4acc196d 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
@@ -1806,13 +1806,8 @@ int vchiq_mmal_init(struct vchiq_mmal_instance 
**out_instance)
SERVICE_CREATION_T params = {
.version= VCHI_VERSION_EX(VC_MMAL_VER, 
VC_MMAL_MIN_VER),
.service_id = VC_MMAL_SERVER_NAME,
-   .rx_fifo_size   = 0,
-   .tx_fifo_size   = 0,
.callback   = service_callback,
.callback_param = NULL,
-   .want_unaligned_bulk_rx = 1,
-   .want_unaligned_bulk_tx = 1,
-   .want_crc   = 0
};
 
/* compile time checks to ensure structure size as they are
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h 
b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 1ea997c658f9..347825329ea4 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -77,19 +77,8 @@ typedef struct {
 typedef struct {
struct vchi_version version;
int32_t service_id;
-   uint32_t rx_fifo_size;
-   uint32_t tx_fifo_size;
VCHI_CALLBACK_T callback;
void *callback_param;
-   /* client intends to receive bulk transfers of
-   odd lengths or into unaligned buffers */
-   int32_t want_unaligned_bulk_rx;
-   /* client intends to transmit bulk transfers of
-   odd lengths or out of unaligned buffers */
-   int32_t want_unaligned_bulk_tx;
-   /* client wants to check CRCs on (bulk) xfers.
-   Only needs to be set at 1 end - will do both directions. */
-   int32_t want_crc;
 } SERVICE_CREATION_T;
 
 // Opaque handle for a VCHI instance
-- 
2.18.0

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


[PATCH 7/7] staging: vc04_services: Drop no longer needed headers

2018-10-04 Thread Tuomas Tynkkynen
Previously, connection.h was only required for the definition of
VCHI_CONNECTION_T, but now all usages of it are gone. Remove this unused
header.

After connection.h is gone, message.h and vchi_cfg_internal.h are no
longer referenced by anything either. Drop them as well.

Signed-off-by: Tuomas Tynkkynen 
---
 .../interface/vchi/connections/connection.h   | 324 --
 .../interface/vchi/message_drivers/message.h  | 196 ---
 .../vc04_services/interface/vchi/vchi.h   |   1 -
 .../interface/vchi/vchi_cfg_internal.h|  71 
 4 files changed, 592 deletions(-)
 delete mode 100644 
drivers/staging/vc04_services/interface/vchi/connections/connection.h
 delete mode 100644 
drivers/staging/vc04_services/interface/vchi/message_drivers/message.h
 delete mode 100644 
drivers/staging/vc04_services/interface/vchi/vchi_cfg_internal.h

diff --git 
a/drivers/staging/vc04_services/interface/vchi/connections/connection.h 
b/drivers/staging/vc04_services/interface/vchi/connections/connection.h
deleted file mode 100644
index 67c84386c65a..
--- a/drivers/staging/vc04_services/interface/vchi/connections/connection.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/**
- * Copyright (c) 2010-2012 Broadcom. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *notice, this list of conditions, and the following disclaimer,
- *without modification.
- * 2. Redistributions in binary form must reproduce the above copyright
- *notice, this list of conditions and the following disclaimer in the
- *documentation and/or other materials provided with the distribution.
- * 3. The names of the above-listed copyright holders may not be used
- *to endorse or promote products derived from this software without
- *specific prior written permission.
- *
- * ALTERNATIVELY, this software may be distributed under the terms of the
- * GNU General Public License ("GPL") version 2, as published by the Free
- * Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CONNECTION_H_
-#define CONNECTION_H_
-
-#include 
-#include 
-#include 
-
-#include "interface/vchi/vchi_cfg_internal.h"
-#include "interface/vchi/vchi_common.h"
-#include "interface/vchi/message_drivers/message.h"
-
-/**
- Global defs
- */
-
-// Opaque handle for a connection / service pair
-typedef struct opaque_vchi_connection_connected_service_handle_t 
*VCHI_CONNECTION_SERVICE_HANDLE_T;
-
-// opaque handle to the connection state information
-typedef struct opaque_vchi_connection_info_t VCHI_CONNECTION_STATE_T;
-
-typedef struct vchi_connection_t VCHI_CONNECTION_T;
-
-/**
- API
- */
-
-// Routine to init a connection with a particular low level driver
-typedef VCHI_CONNECTION_STATE_T * (*VCHI_CONNECTION_INIT_T)( struct 
vchi_connection_t * connection,
- const 
VCHI_MESSAGE_DRIVER_T * driver );
-
-// Routine to control CRC enabling at a connection level
-typedef int32_t (*VCHI_CONNECTION_CRC_CONTROL_T)( VCHI_CONNECTION_STATE_T 
*state_handle,
-  VCHI_CRC_CONTROL_T control );
-
-// Routine to create a service
-typedef int32_t (*VCHI_CONNECTION_SERVICE_CONNECT_T)( VCHI_CONNECTION_STATE_T 
*state_handle,
-  int32_t service_id,
-  uint32_t rx_fifo_size,
-  uint32_t tx_fifo_size,
-  int server,
-  VCHI_CALLBACK_T callback,
-

[PATCH 1/2] staging: bcm2835-audio: Check if workqueue allocation failed

2018-07-12 Thread Tuomas Tynkkynen
Currently, if allocating a workqueue fails, the driver will probe
successfully but it will silently do nothing, which is rather silly.
So instead bail out with -ENOMEM in bcm2835_audio_open() if
alloc_workqueue() fails, and remove the now pointless checks for a NULL
workqueue.

While at it, get rid of the rather pointless one-line function
my_workqueue_init().

Signed-off-by: Tuomas Tynkkynen 
---
 .../vc04_services/bcm2835-audio/bcm2835-vchiq.c| 111 ++---
 1 file changed, 50 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index a4a48f31f1a3..85ed807bb873 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -118,44 +118,40 @@ static void my_wq_function(struct work_struct *work)
 
 int bcm2835_audio_start(struct bcm2835_alsa_stream *alsa_stream)
 {
-   if (alsa_stream->my_wq) {
-   struct bcm2835_audio_work *work;
-
-   work = kmalloc(sizeof(*work), GFP_ATOMIC);
-   /*--- Queue some work (item 1) ---*/
-   if (!work) {
-   LOG_ERR(" .. Error: NULL work kmalloc\n");
-   return -ENOMEM;
-   }
-   INIT_WORK(&work->my_work, my_wq_function);
-   work->alsa_stream = alsa_stream;
-   work->cmd = BCM2835_AUDIO_START;
-   if (!queue_work(alsa_stream->my_wq, &work->my_work)) {
-   kfree(work);
-   return -EBUSY;
-   }
+   struct bcm2835_audio_work *work;
+
+   work = kmalloc(sizeof(*work), GFP_ATOMIC);
+   /*--- Queue some work (item 1) ---*/
+   if (!work) {
+   LOG_ERR(" .. Error: NULL work kmalloc\n");
+   return -ENOMEM;
+   }
+   INIT_WORK(&work->my_work, my_wq_function);
+   work->alsa_stream = alsa_stream;
+   work->cmd = BCM2835_AUDIO_START;
+   if (!queue_work(alsa_stream->my_wq, &work->my_work)) {
+   kfree(work);
+   return -EBUSY;
}
return 0;
 }
 
 int bcm2835_audio_stop(struct bcm2835_alsa_stream *alsa_stream)
 {
-   if (alsa_stream->my_wq) {
-   struct bcm2835_audio_work *work;
-
-   work = kmalloc(sizeof(*work), GFP_ATOMIC);
-   /*--- Queue some work (item 1) ---*/
-   if (!work) {
-   LOG_ERR(" .. Error: NULL work kmalloc\n");
-   return -ENOMEM;
-   }
-   INIT_WORK(&work->my_work, my_wq_function);
-   work->alsa_stream = alsa_stream;
-   work->cmd = BCM2835_AUDIO_STOP;
-   if (!queue_work(alsa_stream->my_wq, &work->my_work)) {
-   kfree(work);
-   return -EBUSY;
-   }
+   struct bcm2835_audio_work *work;
+
+   work = kmalloc(sizeof(*work), GFP_ATOMIC);
+   /*--- Queue some work (item 1) ---*/
+   if (!work) {
+   LOG_ERR(" .. Error: NULL work kmalloc\n");
+   return -ENOMEM;
+   }
+   INIT_WORK(&work->my_work, my_wq_function);
+   work->alsa_stream = alsa_stream;
+   work->cmd = BCM2835_AUDIO_STOP;
+   if (!queue_work(alsa_stream->my_wq, &work->my_work)) {
+   kfree(work);
+   return -EBUSY;
}
return 0;
 }
@@ -163,40 +159,31 @@ int bcm2835_audio_stop(struct bcm2835_alsa_stream 
*alsa_stream)
 int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream,
unsigned int count, void *src)
 {
-   if (alsa_stream->my_wq) {
-   struct bcm2835_audio_work *work;
-
-   work = kmalloc(sizeof(*work), GFP_ATOMIC);
-   /*--- Queue some work (item 1) ---*/
-   if (!work) {
-   LOG_ERR(" .. Error: NULL work kmalloc\n");
-   return -ENOMEM;
-   }
-   INIT_WORK(&work->my_work, my_wq_function);
-   work->alsa_stream = alsa_stream;
-   work->cmd = BCM2835_AUDIO_WRITE;
-   work->src = src;
-   work->count = count;
-   if (!queue_work(alsa_stream->my_wq, &work->my_work)) {
-   kfree(work);
-   return -EBUSY;
-   }
+   struct bcm2835_audio_work *work;
+
+   work = kmalloc(sizeof(*work), GFP_ATOMIC);
+   /*--- Queue some work (item 1) ---*/
+   if (!work) {
+   LOG_ERR(" .. Error: NULL work kmalloc\n");
+   return -ENOMEM;
+   }
+   INIT_WORK(&work->my_work, my_wq_function);
+   work->alsa_stream

[PATCH 2/2] staging: bcm2835-audio: Don't leak workqueue if open fails

2018-07-12 Thread Tuomas Tynkkynen
Currently, if bcm2835_audio_open() fails partway, the allocated
workqueue is leaked. Avoid that.

While at it, propagate the return value of
bcm2835_audio_open_connection() on failure instead of returning -1.

Signed-off-by: Tuomas Tynkkynen 
---
 .../staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c  | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c 
b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index 85ed807bb873..779c1e993b55 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -416,16 +416,16 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream 
*alsa_stream)
return -ENOMEM;
 
ret = bcm2835_audio_open_connection(alsa_stream);
-   if (ret) {
-   ret = -1;
-   goto exit;
-   }
+   if (ret)
+   goto free_wq;
+
instance = alsa_stream->instance;
LOG_DBG(" instance (%p)\n", instance);
 
if (mutex_lock_interruptible(&instance->vchi_mutex)) {
LOG_DBG("Interrupted whilst waiting for lock on (%d)\n", 
instance->num_connections);
-   return -EINTR;
+   ret = -EINTR;
+   goto free_wq;
}
vchi_service_use(instance->vchi_handle[0]);
 
@@ -448,7 +448,11 @@ int bcm2835_audio_open(struct bcm2835_alsa_stream 
*alsa_stream)
 unlock:
vchi_service_release(instance->vchi_handle[0]);
mutex_unlock(&instance->vchi_mutex);
-exit:
+
+free_wq:
+   if (ret)
+   destroy_workqueue(alsa_stream->my_wq);
+
return ret;
 }
 
-- 
2.16.3

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


[PATCH] staging: goldfish: Call free_irq in error path

2014-04-07 Thread Tuomas Tynkkynen
If misc_register failed in goldfish_audio_probe, the already requested
IRQ wouldn't get freed. Add a call to free_irq() like there is in
goldfish_audio_remove().

Signed-off-by: Tuomas Tynkkynen 
---
Only compile tested. For the Eudyptula Challenge.
 drivers/staging/goldfish/goldfish_audio.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/goldfish/goldfish_audio.c 
b/drivers/staging/goldfish/goldfish_audio.c
index f96dcec..7ac2602 100644
--- a/drivers/staging/goldfish/goldfish_audio.c
+++ b/drivers/staging/goldfish/goldfish_audio.c
@@ -334,6 +334,7 @@ static int goldfish_audio_probe(struct platform_device 
*pdev)
return 0;
 
 err_misc_register_failed:
+   free_irq(data->irq, data);
 err_request_irq_failed:
dma_free_coherent(&pdev->dev, COMBINED_BUFFER_SIZE,
data->buffer_virt, data->buffer_phys);
-- 
1.7.9.5

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


[PATCH] staging: lirc: Fix sparse warnings

2014-05-08 Thread Tuomas Tynkkynen
Fix sparse warnings by adding __user and __iomem annotations where
necessary and removing certain unnecessary casts.

Signed-off-by: Tuomas Tynkkynen 
---
Compile tested only.
 drivers/staging/media/lirc/lirc_bt829.c|6 +++---
 drivers/staging/media/lirc/lirc_parallel.c |   17 +
 drivers/staging/media/lirc/lirc_serial.c   |8 
 drivers/staging/media/lirc/lirc_sir.c  |   18 +-
 drivers/staging/media/lirc/lirc_zilog.c|   20 +++-
 5 files changed, 36 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_bt829.c 
b/drivers/staging/media/lirc/lirc_bt829.c
index 30edc74..fe01054 100644
--- a/drivers/staging/media/lirc/lirc_bt829.c
+++ b/drivers/staging/media/lirc/lirc_bt829.c
@@ -64,7 +64,7 @@ static bool debug;
 
 static int atir_minor;
 static phys_addr_t pci_addr_phys;
-static unsigned char *pci_addr_lin;
+static unsigned char __iomem *pci_addr_lin;
 
 static struct lirc_driver atir_driver;
 
@@ -382,7 +382,7 @@ static unsigned char do_get_bits(void)
 
 static unsigned int read_index(unsigned char index)
 {
-   unsigned char *addr;
+   unsigned char __iomem *addr;
unsigned int value;
/*  addr = pci_addr_lin + DATA_PCI_OFF + ((index & 0xFF) << 2); */
addr = pci_addr_lin + ((index & 0xFF) << 2);
@@ -392,7 +392,7 @@ static unsigned int read_index(unsigned char index)
 
 static void write_index(unsigned char index, unsigned int reg_val)
 {
-   unsigned char *addr;
+   unsigned char __iomem *addr;
addr = pci_addr_lin + ((index & 0xFF) << 2);
writel(reg_val, addr);
 }
diff --git a/drivers/staging/media/lirc/lirc_parallel.c 
b/drivers/staging/media/lirc/lirc_parallel.c
index 62f5137..ea11fbb 100644
--- a/drivers/staging/media/lirc/lirc_parallel.c
+++ b/drivers/staging/media/lirc/lirc_parallel.c
@@ -324,7 +324,8 @@ static loff_t lirc_lseek(struct file *filep, loff_t offset, 
int orig)
return -ESPIPE;
 }
 
-static ssize_t lirc_read(struct file *filep, char *buf, size_t n, loff_t *ppos)
+static ssize_t lirc_read(struct file *filep, char __user *buf, size_t n,
+loff_t *ppos)
 {
int result = 0;
int count = 0;
@@ -362,7 +363,7 @@ static ssize_t lirc_read(struct file *filep, char *buf, 
size_t n, loff_t *ppos)
return count ? count : result;
 }
 
-static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
+static ssize_t lirc_write(struct file *filep, const char __user *buf, size_t n,
  loff_t *ppos)
 {
int count;
@@ -470,36 +471,36 @@ static long lirc_ioctl(struct file *filep, unsigned int 
cmd, unsigned long arg)
 
switch (cmd) {
case LIRC_GET_FEATURES:
-   result = put_user(features, (__u32 *) arg);
+   result = put_user(features, (__u32 __user *) arg);
if (result)
return result;
break;
case LIRC_GET_SEND_MODE:
-   result = put_user(LIRC_MODE_PULSE, (__u32 *) arg);
+   result = put_user(LIRC_MODE_PULSE, (__u32 __user *) arg);
if (result)
return result;
break;
case LIRC_GET_REC_MODE:
-   result = put_user(LIRC_MODE_MODE2, (__u32 *) arg);
+   result = put_user(LIRC_MODE_MODE2, (__u32 __user *) arg);
if (result)
return result;
break;
case LIRC_SET_SEND_MODE:
-   result = get_user(mode, (__u32 *) arg);
+   result = get_user(mode, (__u32 __user *) arg);
if (result)
return result;
if (mode != LIRC_MODE_PULSE)
return -EINVAL;
break;
case LIRC_SET_REC_MODE:
-   result = get_user(mode, (__u32 *) arg);
+   result = get_user(mode, (__u32 __user *) arg);
if (result)
return result;
if (mode != LIRC_MODE_MODE2)
return -ENOSYS;
break;
case LIRC_SET_TRANSMITTER_MASK:
-   result = get_user(value, (__u32 *) arg);
+   result = get_user(value, (__u32 __user *) arg);
if (result)
return result;
if ((value & LIRC_PARALLEL_TRANSMITTER_MASK) != value)
diff --git a/drivers/staging/media/lirc/lirc_serial.c 
b/drivers/staging/media/lirc/lirc_serial.c
index 10c685d..5fced89 100644
--- a/drivers/staging/media/lirc/lirc_serial.c
+++ b/drivers/staging/media/lirc/lirc_serial.c
@@ -1020,7 +1020,7 @@ static long lirc_ioctl(struct file *filep, unsigned int 
cmd, unsigned long arg)
 
result = put_user(LIRC_SEND2MODE
  (hardware[type].features&LIRC_CAN_SEND_MASK),
-

[PATCH v2] staging: lirc: Fix sparse warnings

2014-05-08 Thread Tuomas Tynkkynen
Fix sparse warnings by adding __user and __iomem annotations where
necessary and removing certain unnecessary casts. While at it,
also use u32 in place of __u32.

Signed-off-by: Tuomas Tynkkynen 
---
 Compile tested only.
 v2 changes:
   - introduce variable 'uptr' instead of open-coding (__u32 *)arg everywhere
   - replaces __u32 with u32
   - passes checkpatch --strict
 drivers/staging/media/lirc/lirc_bt829.c|6 ++---
 drivers/staging/media/lirc/lirc_parallel.c |   26 --
 drivers/staging/media/lirc/lirc_serial.c   |   11 +-
 drivers/staging/media/lirc/lirc_sir.c  |   33 ++--
 drivers/staging/media/lirc/lirc_zilog.c|   23 +--
 5 files changed, 52 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_bt829.c 
b/drivers/staging/media/lirc/lirc_bt829.c
index 30edc74..fe01054 100644
--- a/drivers/staging/media/lirc/lirc_bt829.c
+++ b/drivers/staging/media/lirc/lirc_bt829.c
@@ -64,7 +64,7 @@ static bool debug;
 
 static int atir_minor;
 static phys_addr_t pci_addr_phys;
-static unsigned char *pci_addr_lin;
+static unsigned char __iomem *pci_addr_lin;
 
 static struct lirc_driver atir_driver;
 
@@ -382,7 +382,7 @@ static unsigned char do_get_bits(void)
 
 static unsigned int read_index(unsigned char index)
 {
-   unsigned char *addr;
+   unsigned char __iomem *addr;
unsigned int value;
/*  addr = pci_addr_lin + DATA_PCI_OFF + ((index & 0xFF) << 2); */
addr = pci_addr_lin + ((index & 0xFF) << 2);
@@ -392,7 +392,7 @@ static unsigned int read_index(unsigned char index)
 
 static void write_index(unsigned char index, unsigned int reg_val)
 {
-   unsigned char *addr;
+   unsigned char __iomem *addr;
addr = pci_addr_lin + ((index & 0xFF) << 2);
writel(reg_val, addr);
 }
diff --git a/drivers/staging/media/lirc/lirc_parallel.c 
b/drivers/staging/media/lirc/lirc_parallel.c
index 62f5137..1394f02 100644
--- a/drivers/staging/media/lirc/lirc_parallel.c
+++ b/drivers/staging/media/lirc/lirc_parallel.c
@@ -324,7 +324,8 @@ static loff_t lirc_lseek(struct file *filep, loff_t offset, 
int orig)
return -ESPIPE;
 }
 
-static ssize_t lirc_read(struct file *filep, char *buf, size_t n, loff_t *ppos)
+static ssize_t lirc_read(struct file *filep, char __user *buf, size_t n,
+loff_t *ppos)
 {
int result = 0;
int count = 0;
@@ -362,7 +363,7 @@ static ssize_t lirc_read(struct file *filep, char *buf, 
size_t n, loff_t *ppos)
return count ? count : result;
 }
 
-static ssize_t lirc_write(struct file *filep, const char *buf, size_t n,
+static ssize_t lirc_write(struct file *filep, const char __user *buf, size_t n,
  loff_t *ppos)
 {
int count;
@@ -463,43 +464,44 @@ static unsigned int lirc_poll(struct file *file, 
poll_table *wait)
 static long lirc_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 {
int result;
-   __u32 features = LIRC_CAN_SET_TRANSMITTER_MASK |
-LIRC_CAN_SEND_PULSE | LIRC_CAN_REC_MODE2;
-   __u32 mode;
-   __u32 value;
+   u32 __user *uptr = (u32 __user *)arg;
+   u32 features = LIRC_CAN_SET_TRANSMITTER_MASK |
+  LIRC_CAN_SEND_PULSE | LIRC_CAN_REC_MODE2;
+   u32 mode;
+   u32 value;
 
switch (cmd) {
case LIRC_GET_FEATURES:
-   result = put_user(features, (__u32 *) arg);
+   result = put_user(features, uptr);
if (result)
return result;
break;
case LIRC_GET_SEND_MODE:
-   result = put_user(LIRC_MODE_PULSE, (__u32 *) arg);
+   result = put_user(LIRC_MODE_PULSE, uptr);
if (result)
return result;
break;
case LIRC_GET_REC_MODE:
-   result = put_user(LIRC_MODE_MODE2, (__u32 *) arg);
+   result = put_user(LIRC_MODE_MODE2, uptr);
if (result)
return result;
break;
case LIRC_SET_SEND_MODE:
-   result = get_user(mode, (__u32 *) arg);
+   result = get_user(mode, uptr);
if (result)
return result;
if (mode != LIRC_MODE_PULSE)
return -EINVAL;
break;
case LIRC_SET_REC_MODE:
-   result = get_user(mode, (__u32 *) arg);
+   result = get_user(mode, uptr);
if (result)
return result;
if (mode != LIRC_MODE_MODE2)
return -ENOSYS;
break;
case LIRC_SET_TRANSMITTER_MASK:
-   result = get_user(value, (__u32 *) arg);
+   result = get_user(value, uptr);
if (result)
r