linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] staging: vc04_services: avoid the use of typedef for function pointers
@ 2021-12-30 11:31 Gaston Gonzalez
  2021-12-30 11:31 ` [PATCH v2 1/3] staging: vc04_services: bcm2835-audio: " Gaston Gonzalez
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Gaston Gonzalez @ 2021-12-30 11:31 UTC (permalink / raw)
  To: linux-staging
  Cc: gregkh, nsaenz, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, juerg.haefliger, rdunlap,
	dave.stevenson, stefan.wahren, unixbhaskar, mitaliborkar810,
	phil, linux-rpi-kernel, linux-arm-kernel, linux-kernel, gascoar

This patch set removes some typedefs for function pointers in vc04_services.

v1 -> v2:

- Following Greg suggestion, functions pointers were not renamed making patches
  1 and 2 much smaller.
- Function pointers in vchiq-mmal were not touched as the result is less
  readable than the original.
- In the description of changes in the TODO file, it was specified that there
  are no current 'struct typedefs' left inside vc04_servivces. 
- The name of the particular subsystem of vc04_services was included in the
  title of each commit.

Gaston Gonzalez (3):
  staging: vc04_services: bcm2835-audio: avoid the use of typedef for
    function pointers
  staging: vc04_services: bcm2835-camera: avoid the use of typedef for
    function pointers
  staging: vc04_services: update TODO file

 .../staging/vc04_services/bcm2835-audio/bcm2835.c    | 12 +++---------
 .../staging/vc04_services/bcm2835-camera/controls.c  | 10 ++--------
 drivers/staging/vc04_services/interface/TODO         |  8 ++------
 3 files changed, 7 insertions(+), 23 deletions(-)

-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/3] staging: vc04_services: bcm2835-audio: avoid the use of typedef for function pointers
  2021-12-30 11:31 [PATCH v2 0/3] staging: vc04_services: avoid the use of typedef for function pointers Gaston Gonzalez
@ 2021-12-30 11:31 ` Gaston Gonzalez
  2021-12-30 11:31 ` [PATCH v2 2/3] staging: vc04_services: bcm2835-camera: " Gaston Gonzalez
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Gaston Gonzalez @ 2021-12-30 11:31 UTC (permalink / raw)
  To: linux-staging
  Cc: gregkh, nsaenz, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, juerg.haefliger, rdunlap,
	dave.stevenson, stefan.wahren, unixbhaskar, mitaliborkar810,
	phil, linux-rpi-kernel, linux-arm-kernel, linux-kernel, gascoar

Replace typedefs bcm2835_audio_newpcm_func and bcm2835_audio_newctl_func
with equivalent declarations to better align with the linux kernel
coding style.

Signed-off-by: Gaston Gonzalez <gascoar@gmail.com>
---
 .../staging/vc04_services/bcm2835-audio/bcm2835.c    | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
index c250fbef2fa3..628732d7bf6a 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
@@ -52,20 +52,14 @@ static int bcm2835_devm_add_vchi_ctx(struct device *dev)
 	return 0;
 }
 
-typedef int (*bcm2835_audio_newpcm_func)(struct bcm2835_chip *chip,
-					 const char *name,
-					 enum snd_bcm2835_route route,
-					 u32 numchannels);
-
-typedef int (*bcm2835_audio_newctl_func)(struct bcm2835_chip *chip);
-
 struct bcm2835_audio_driver {
 	struct device_driver driver;
 	const char *shortname;
 	const char *longname;
 	int minchannels;
-	bcm2835_audio_newpcm_func newpcm;
-	bcm2835_audio_newctl_func newctl;
+	int (*newpcm)(struct bcm2835_chip *chip, const char *name,
+		      enum snd_bcm2835_route route, u32 numchannels);
+	int (*newctl)(struct bcm2835_chip *chip);
 	enum snd_bcm2835_route route;
 };
 
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/3] staging: vc04_services: bcm2835-camera: avoid the use of typedef for function pointers
  2021-12-30 11:31 [PATCH v2 0/3] staging: vc04_services: avoid the use of typedef for function pointers Gaston Gonzalez
  2021-12-30 11:31 ` [PATCH v2 1/3] staging: vc04_services: bcm2835-audio: " Gaston Gonzalez
@ 2021-12-30 11:31 ` Gaston Gonzalez
  2021-12-30 11:31 ` [PATCH v2 3/3] staging: vc04_services: update TODO file Gaston Gonzalez
  2021-12-30 13:20 ` [PATCH v2 0/3] staging: vc04_services: avoid the use of typedef for function pointers Greg KH
  3 siblings, 0 replies; 6+ messages in thread
From: Gaston Gonzalez @ 2021-12-30 11:31 UTC (permalink / raw)
  To: linux-staging
  Cc: gregkh, nsaenz, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, juerg.haefliger, rdunlap,
	dave.stevenson, stefan.wahren, unixbhaskar, mitaliborkar810,
	phil, linux-rpi-kernel, linux-arm-kernel, linux-kernel, gascoar

Replace typedef bm2835_mmal_v4l2_ctrl_cb with equivalent declaration to
better align with the linux kernel coding style.

Signed-off-by: Gaston Gonzalez <gascoar@gmail.com>
---
 .../staging/vc04_services/bcm2835-camera/controls.c    | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/controls.c b/drivers/staging/vc04_services/bcm2835-camera/controls.c
index b096a12387f7..3696dfb5a020 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
@@ -65,13 +65,6 @@ enum bm2835_mmal_ctrl_type {
 	MMAL_CONTROL_TYPE_CLUSTER, /* special cluster entry */
 };
 
-struct bm2835_mmal_v4l2_ctrl;
-
-typedef	int(bm2835_mmal_v4l2_ctrl_cb)(
-				struct bm2835_mmal_dev *dev,
-				struct v4l2_ctrl *ctrl,
-				const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl);
-
 struct bm2835_mmal_v4l2_ctrl {
 	u32 id; /* v4l2 control identifier */
 	enum bm2835_mmal_ctrl_type type;
@@ -84,7 +77,8 @@ struct bm2835_mmal_v4l2_ctrl {
 	u64 step; /* step size of the control */
 	const s64 *imenu; /* integer menu array */
 	u32 mmal_id; /* mmal parameter id */
-	bm2835_mmal_v4l2_ctrl_cb *setter;
+	int (*setter)(struct bm2835_mmal_dev *dev, struct v4l2_ctrl *ctrl,
+		      const struct bm2835_mmal_v4l2_ctrl *mmal_ctrl);
 };
 
 struct v4l2_to_mmal_effects_setting {
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 3/3] staging: vc04_services: update TODO file
  2021-12-30 11:31 [PATCH v2 0/3] staging: vc04_services: avoid the use of typedef for function pointers Gaston Gonzalez
  2021-12-30 11:31 ` [PATCH v2 1/3] staging: vc04_services: bcm2835-audio: " Gaston Gonzalez
  2021-12-30 11:31 ` [PATCH v2 2/3] staging: vc04_services: bcm2835-camera: " Gaston Gonzalez
@ 2021-12-30 11:31 ` Gaston Gonzalez
  2022-01-06 12:51   ` Dan Carpenter
  2021-12-30 13:20 ` [PATCH v2 0/3] staging: vc04_services: avoid the use of typedef for function pointers Greg KH
  3 siblings, 1 reply; 6+ messages in thread
From: Gaston Gonzalez @ 2021-12-30 11:31 UTC (permalink / raw)
  To: linux-staging
  Cc: gregkh, nsaenz, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, juerg.haefliger, rdunlap,
	dave.stevenson, stefan.wahren, unixbhaskar, mitaliborkar810,
	phil, linux-rpi-kernel, linux-arm-kernel, linux-kernel, gascoar

There are no struct typedef remaining inside vc04_services/. Hence, remove the
task from the TODO file.

While at it, fix the items sequential numbering.

Signed-off-by: Gaston Gonzalez <gascoar@gmail.com>
---
 drivers/staging/vc04_services/interface/TODO | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/TODO b/drivers/staging/vc04_services/interface/TODO
index 39810ce017cd..241ca004735c 100644
--- a/drivers/staging/vc04_services/interface/TODO
+++ b/drivers/staging/vc04_services/interface/TODO
@@ -80,11 +80,7 @@ vchiq-core.ko and vchiq-dev.ko. This would also ease the upstreaming process.
 
 The code in vchiq_bcm2835_arm.c should fit in the generic platform file.
 
-12) Get rid of all the struct typedefs
-
-Most structs are typedefd, it's not encouraged in the kernel.
-
-13) Get rid of all non essential global structures and create a proper per
+11) Get rid of all non essential global structures and create a proper per
 device structure
 
 The first thing one generally sees in a probe function is a memory allocation
@@ -92,6 +88,6 @@ for all the device specific data. This structure is then passed all over the
 driver. This is good practice since it makes the driver work regardless of the
 number of devices probed.
 
-14) Clean up Sparse warnings from __user annotations. See
+12) Clean up Sparse warnings from __user annotations. See
 vchiq_irq_queue_bulk_tx_rx(). Ensure that the address of "&waiter->bulk_waiter"
 is never disclosed to userspace.
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/3] staging: vc04_services: avoid the use of typedef for function pointers
  2021-12-30 11:31 [PATCH v2 0/3] staging: vc04_services: avoid the use of typedef for function pointers Gaston Gonzalez
                   ` (2 preceding siblings ...)
  2021-12-30 11:31 ` [PATCH v2 3/3] staging: vc04_services: update TODO file Gaston Gonzalez
@ 2021-12-30 13:20 ` Greg KH
  3 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2021-12-30 13:20 UTC (permalink / raw)
  To: Gaston Gonzalez
  Cc: linux-staging, nsaenz, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, juerg.haefliger, rdunlap,
	dave.stevenson, stefan.wahren, unixbhaskar, mitaliborkar810,
	phil, linux-rpi-kernel, linux-arm-kernel, linux-kernel

On Thu, Dec 30, 2021 at 08:31:23AM -0300, Gaston Gonzalez wrote:
> This patch set removes some typedefs for function pointers in vc04_services.
> 
> v1 -> v2:
> 
> - Following Greg suggestion, functions pointers were not renamed making patches
>   1 and 2 much smaller.
> - Function pointers in vchiq-mmal were not touched as the result is less
>   readable than the original.
> - In the description of changes in the TODO file, it was specified that there
>   are no current 'struct typedefs' left inside vc04_servivces. 
> - The name of the particular subsystem of vc04_services was included in the
>   title of each commit.

Much nicer, thanks for redoing this.  Now queued up.

greg k-h

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 3/3] staging: vc04_services: update TODO file
  2021-12-30 11:31 ` [PATCH v2 3/3] staging: vc04_services: update TODO file Gaston Gonzalez
@ 2022-01-06 12:51   ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2022-01-06 12:51 UTC (permalink / raw)
  To: Gaston Gonzalez
  Cc: linux-staging, gregkh, nsaenz, f.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, juerg.haefliger, rdunlap,
	dave.stevenson, stefan.wahren, unixbhaskar, mitaliborkar810,
	phil, linux-rpi-kernel, linux-arm-kernel, linux-kernel

On Thu, Dec 30, 2021 at 08:31:29AM -0300, Gaston Gonzalez wrote:
> There are no struct typedef remaining inside vc04_services/. Hence, remove the
> task from the TODO file.
> 
> While at it, fix the items sequential numbering.

The previous developers who let the numbers bitrot did the right thing.
There is a kind of ethereal beauty to misnumbered TODO lists.  #Hyperart

Or just replace the numbers with asterisks.

regards,
dan carpenter


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-01-06 12:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-30 11:31 [PATCH v2 0/3] staging: vc04_services: avoid the use of typedef for function pointers Gaston Gonzalez
2021-12-30 11:31 ` [PATCH v2 1/3] staging: vc04_services: bcm2835-audio: " Gaston Gonzalez
2021-12-30 11:31 ` [PATCH v2 2/3] staging: vc04_services: bcm2835-camera: " Gaston Gonzalez
2021-12-30 11:31 ` [PATCH v2 3/3] staging: vc04_services: update TODO file Gaston Gonzalez
2022-01-06 12:51   ` Dan Carpenter
2021-12-30 13:20 ` [PATCH v2 0/3] staging: vc04_services: avoid the use of typedef for function pointers Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).