All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] staging: sm750fb: remove typedef for enum
@ 2017-10-02  2:50 Keerthi Reddy
  2017-10-02  5:54 ` [Outreachy kernel] " Julia Lawall
  0 siblings, 1 reply; 2+ messages in thread
From: Keerthi Reddy @ 2017-10-02  2:50 UTC (permalink / raw)
  To: outreachy-kernel

Using typedef will hide that 'DPMS_t' is enum. Removing this
will make sure that we are actually working with enum. Also is not
a good coding style to use typedef.

Signed-off-by: Keerthi Reddy <keerthigd4990@gmail.com>
---
changes in v3:
edit commit message

changes in v2:
1. Lower case the name and drop the _t which traditionally indicates
typedef
2. make the same change in ddk750_sii164.{c,h}

 drivers/staging/sm750fb/ddk750_power.c  | 2 +-
 drivers/staging/sm750fb/ddk750_power.h  | 7 +++----
 drivers/staging/sm750fb/ddk750_sii164.c | 3 ++-
 drivers/staging/sm750fb/ddk750_sii164.h | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c
index 222ae1a..6f82ab0 100644
--- a/drivers/staging/sm750fb/ddk750_power.c
+++ b/drivers/staging/sm750fb/ddk750_power.c
@@ -2,7 +2,7 @@
 #include "ddk750_reg.h"
 #include "ddk750_power.h"
 
-void ddk750_set_dpms(DPMS_t state)
+void ddk750_set_dpms(enum dpms state)
 {
 	unsigned int value;
 
diff --git a/drivers/staging/sm750fb/ddk750_power.h b/drivers/staging/sm750fb/ddk750_power.h
index 44c4fc5..033889f 100644
--- a/drivers/staging/sm750fb/ddk750_power.h
+++ b/drivers/staging/sm750fb/ddk750_power.h
@@ -1,20 +1,19 @@
 #ifndef DDK750_POWER_H__
 #define DDK750_POWER_H__
 
-typedef enum _DPMS_t {
+enum dpms {
 	crtDPMS_ON = 0x0,
 	crtDPMS_STANDBY = 0x1,
 	crtDPMS_SUSPEND = 0x2,
 	crtDPMS_OFF = 0x3,
-}
-DPMS_t;
+};
 
 #define setDAC(off) {							\
 	poke32(MISC_CTRL,						\
 	       (peek32(MISC_CTRL) & ~MISC_CTRL_DAC_POWER_OFF) | (off)); \
 }
 
-void ddk750_set_dpms(DPMS_t state);
+void ddk750_set_dpms(enum dpms state);
 void sm750_set_power_mode(unsigned int powerMode);
 void sm750_set_current_gate(unsigned int gate);
 
diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
index 0431833..3d68e1d 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -296,7 +296,8 @@ void sii164SetPower(unsigned char powerUp)
  *  sii164SelectHotPlugDetectionMode
  *      This function selects the mode of the hot plug detection.
  */
-static void sii164SelectHotPlugDetectionMode(sii164_hot_plug_mode_t hotPlugMode)
+static
+void sii164SelectHotPlugDetectionMode(enum sii164_hot_plug_mode hotPlugMode)
 {
 	unsigned char detectReg;
 
diff --git a/drivers/staging/sm750fb/ddk750_sii164.h b/drivers/staging/sm750fb/ddk750_sii164.h
index 6968cf5..e06ba72 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.h
+++ b/drivers/staging/sm750fb/ddk750_sii164.h
@@ -4,12 +4,12 @@
 #define USE_DVICHIP
 
 /* Hot Plug detection mode structure */
-typedef enum _sii164_hot_plug_mode_t {
+enum sii164_hot_plug_mode {
 	SII164_HOTPLUG_DISABLE = 0,         /* Disable Hot Plug output bit (always high). */
 	SII164_HOTPLUG_USE_MDI,             /* Use Monitor Detect Interrupt bit. */
 	SII164_HOTPLUG_USE_RSEN,            /* Use Receiver Sense detect bit. */
 	SII164_HOTPLUG_USE_HTPLG            /* Use Hot Plug detect bit. */
-} sii164_hot_plug_mode_t;
+};
 
 
 /* Silicon Image SiI164 chip prototype */
-- 
2.7.4



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

* Re: [Outreachy kernel] [PATCH v3] staging: sm750fb: remove typedef for enum
  2017-10-02  2:50 [PATCH v3] staging: sm750fb: remove typedef for enum Keerthi Reddy
@ 2017-10-02  5:54 ` Julia Lawall
  0 siblings, 0 replies; 2+ messages in thread
From: Julia Lawall @ 2017-10-02  5:54 UTC (permalink / raw)
  To: Keerthi Reddy; +Cc: outreachy-kernel



On Mon, 2 Oct 2017, Keerthi Reddy wrote:

> Using typedef will hide that 'DPMS_t' is enum. Removing this
> will make sure that we are actually working with enum. Also is not
> a good coding style to use typedef.
>
> Signed-off-by: Keerthi Reddy <keerthigd4990@gmail.com>
> ---
> changes in v3:
> edit commit message
>
> changes in v2:
> 1. Lower case the name and drop the _t which traditionally indicates
> typedef
> 2. make the same change in ddk750_sii164.{c,h}

This is not the same change.  It also relates to an enum, but it doesn't
relate to the type DPMS.  Since the files involved are totally disjoint,
it would be better to just make two patches.

julia


>
>  drivers/staging/sm750fb/ddk750_power.c  | 2 +-
>  drivers/staging/sm750fb/ddk750_power.h  | 7 +++----
>  drivers/staging/sm750fb/ddk750_sii164.c | 3 ++-
>  drivers/staging/sm750fb/ddk750_sii164.h | 4 ++--
>  4 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/sm750fb/ddk750_power.c b/drivers/staging/sm750fb/ddk750_power.c
> index 222ae1a..6f82ab0 100644
> --- a/drivers/staging/sm750fb/ddk750_power.c
> +++ b/drivers/staging/sm750fb/ddk750_power.c
> @@ -2,7 +2,7 @@
>  #include "ddk750_reg.h"
>  #include "ddk750_power.h"
>
> -void ddk750_set_dpms(DPMS_t state)
> +void ddk750_set_dpms(enum dpms state)
>  {
>  	unsigned int value;
>
> diff --git a/drivers/staging/sm750fb/ddk750_power.h b/drivers/staging/sm750fb/ddk750_power.h
> index 44c4fc5..033889f 100644
> --- a/drivers/staging/sm750fb/ddk750_power.h
> +++ b/drivers/staging/sm750fb/ddk750_power.h
> @@ -1,20 +1,19 @@
>  #ifndef DDK750_POWER_H__
>  #define DDK750_POWER_H__
>
> -typedef enum _DPMS_t {
> +enum dpms {
>  	crtDPMS_ON = 0x0,
>  	crtDPMS_STANDBY = 0x1,
>  	crtDPMS_SUSPEND = 0x2,
>  	crtDPMS_OFF = 0x3,
> -}
> -DPMS_t;
> +};
>
>  #define setDAC(off) {							\
>  	poke32(MISC_CTRL,						\
>  	       (peek32(MISC_CTRL) & ~MISC_CTRL_DAC_POWER_OFF) | (off)); \
>  }
>
> -void ddk750_set_dpms(DPMS_t state);
> +void ddk750_set_dpms(enum dpms state);
>  void sm750_set_power_mode(unsigned int powerMode);
>  void sm750_set_current_gate(unsigned int gate);
>
> diff --git a/drivers/staging/sm750fb/ddk750_sii164.c b/drivers/staging/sm750fb/ddk750_sii164.c
> index 0431833..3d68e1d 100644
> --- a/drivers/staging/sm750fb/ddk750_sii164.c
> +++ b/drivers/staging/sm750fb/ddk750_sii164.c
> @@ -296,7 +296,8 @@ void sii164SetPower(unsigned char powerUp)
>   *  sii164SelectHotPlugDetectionMode
>   *      This function selects the mode of the hot plug detection.
>   */
> -static void sii164SelectHotPlugDetectionMode(sii164_hot_plug_mode_t hotPlugMode)
> +static
> +void sii164SelectHotPlugDetectionMode(enum sii164_hot_plug_mode hotPlugMode)
>  {
>  	unsigned char detectReg;
>
> diff --git a/drivers/staging/sm750fb/ddk750_sii164.h b/drivers/staging/sm750fb/ddk750_sii164.h
> index 6968cf5..e06ba72 100644
> --- a/drivers/staging/sm750fb/ddk750_sii164.h
> +++ b/drivers/staging/sm750fb/ddk750_sii164.h
> @@ -4,12 +4,12 @@
>  #define USE_DVICHIP
>
>  /* Hot Plug detection mode structure */
> -typedef enum _sii164_hot_plug_mode_t {
> +enum sii164_hot_plug_mode {
>  	SII164_HOTPLUG_DISABLE = 0,         /* Disable Hot Plug output bit (always high). */
>  	SII164_HOTPLUG_USE_MDI,             /* Use Monitor Detect Interrupt bit. */
>  	SII164_HOTPLUG_USE_RSEN,            /* Use Receiver Sense detect bit. */
>  	SII164_HOTPLUG_USE_HTPLG            /* Use Hot Plug detect bit. */
> -} sii164_hot_plug_mode_t;
> +};
>
>
>  /* Silicon Image SiI164 chip prototype */
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20171002025033.GA2772%40manoharreddy.
> For more options, visit https://groups.google.com/d/optout.
>


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

end of thread, other threads:[~2017-10-02  5:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-02  2:50 [PATCH v3] staging: sm750fb: remove typedef for enum Keerthi Reddy
2017-10-02  5:54 ` [Outreachy kernel] " Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.