diff mbox series

[v3,13/14] mei: debugfs: add pxp mode to devstate in debugfs

Message ID 20220619133721.523546-14-alexander.usyskin@intel.com (mailing list archive)
State New, archived
Headers show
Series GSC support for XeHP SDV and DG2 platforms | expand

Commit Message

Usyskin, Alexander June 19, 2022, 1:37 p.m. UTC
From: Tomas Winkler <tomas.winkler@intel.com>

CC: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/debugfs.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Greg KH June 27, 2022, 2:02 p.m. UTC | #1
On Sun, Jun 19, 2022 at 04:37:20PM +0300, Alexander Usyskin wrote:
> From: Tomas Winkler <tomas.winkler@intel.com>
> 
> CC: Vitaly Lubart <vitaly.lubart@intel.com>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>

We can not take patches without any changelog text, you know this :(

> ---
>  drivers/misc/mei/debugfs.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/misc/mei/debugfs.c b/drivers/misc/mei/debugfs.c
> index 1ce61e9e24fc..4074fec866a6 100644
> --- a/drivers/misc/mei/debugfs.c
> +++ b/drivers/misc/mei/debugfs.c
> @@ -86,6 +86,20 @@ static int mei_dbgfs_active_show(struct seq_file *m, void *unused)
>  }
>  DEFINE_SHOW_ATTRIBUTE(mei_dbgfs_active);
>  
> +static const char *mei_dev_pxp_mode_str(enum mei_dev_pxp_mode state)
> +{
> +#define MEI_PXP_MODE(state) case MEI_DEV_PXP_##state: return #state
> +	switch (state) {
> +	MEI_PXP_MODE(DEFAULT);
> +	MEI_PXP_MODE(INIT);
> +	MEI_PXP_MODE(SETUP);
> +	MEI_PXP_MODE(READY);

Just spell out the case and return lines, don't create macros for no
good reason please.

thanks,

greg k-h
Winkler, Tomas June 29, 2022, 8:37 a.m. UTC | #2
> 
> On Sun, Jun 19, 2022 at 04:37:20PM +0300, Alexander Usyskin wrote:
> > From: Tomas Winkler <tomas.winkler@intel.com>
> >
> > CC: Vitaly Lubart <vitaly.lubart@intel.com>
> > Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
> 
> We can not take patches without any changelog text, you know this :(

Okay, will add some more info. 
> 
> > ---
> >  drivers/misc/mei/debugfs.c | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> >
> > diff --git a/drivers/misc/mei/debugfs.c b/drivers/misc/mei/debugfs.c
> > index 1ce61e9e24fc..4074fec866a6 100644
> > --- a/drivers/misc/mei/debugfs.c
> > +++ b/drivers/misc/mei/debugfs.c
> > @@ -86,6 +86,20 @@ static int mei_dbgfs_active_show(struct seq_file
> > *m, void *unused)  }  DEFINE_SHOW_ATTRIBUTE(mei_dbgfs_active);
> >
> > +static const char *mei_dev_pxp_mode_str(enum mei_dev_pxp_mode
> state)
> > +{ #define MEI_PXP_MODE(state) case MEI_DEV_PXP_##state: return
> #state
> > +	switch (state) {
> > +	MEI_PXP_MODE(DEFAULT);
> > +	MEI_PXP_MODE(INIT);
> > +	MEI_PXP_MODE(SETUP);
> > +	MEI_PXP_MODE(READY);
> 
> Just spell out the case and return lines, don't create macros for no good
> reason please.

We use those print macros paradigm consistently int the code, the macro has a very limited scope.
We are aware of wrong sides of macros but this just little of synthetic sugar  no some wild usage.
We believe it helps readability, and it keeps the code consistent.

Other usages:

hbm.c:#define MEI_HBM_STATUS(status) case MEI_HBMS_##status: return #status
hbm.c:#define MEI_CL_CS(status) case MEI_CL_CONN_##status: return #status
hbm.c:#define MEI_HBM_STATE(state) case MEI_HBM_##state: return #state
init.c:#define MEI_DEV_STATE(state) case MEI_DEV_##state: return #state
init.c:#define MEI_PG_STATE(state) case MEI_PG_##state: return #state


Thanks
Tomas
diff mbox series

Patch

diff --git a/drivers/misc/mei/debugfs.c b/drivers/misc/mei/debugfs.c
index 1ce61e9e24fc..4074fec866a6 100644
--- a/drivers/misc/mei/debugfs.c
+++ b/drivers/misc/mei/debugfs.c
@@ -86,6 +86,20 @@  static int mei_dbgfs_active_show(struct seq_file *m, void *unused)
 }
 DEFINE_SHOW_ATTRIBUTE(mei_dbgfs_active);
 
+static const char *mei_dev_pxp_mode_str(enum mei_dev_pxp_mode state)
+{
+#define MEI_PXP_MODE(state) case MEI_DEV_PXP_##state: return #state
+	switch (state) {
+	MEI_PXP_MODE(DEFAULT);
+	MEI_PXP_MODE(INIT);
+	MEI_PXP_MODE(SETUP);
+	MEI_PXP_MODE(READY);
+	default:
+		return "unknown";
+	}
+#undef MEI_PXP_MODE
+}
+
 static int mei_dbgfs_devstate_show(struct seq_file *m, void *unused)
 {
 	struct mei_device *dev = m->private;
@@ -112,6 +126,9 @@  static int mei_dbgfs_devstate_show(struct seq_file *m, void *unused)
 	seq_printf(m, "pg:  %s, %s\n",
 		   mei_pg_is_enabled(dev) ? "ENABLED" : "DISABLED",
 		   mei_pg_state_str(mei_pg_state(dev)));
+
+	seq_printf(m, "pxp: %s\n", mei_dev_pxp_mode_str(dev->pxp_mode));
+
 	return 0;
 }
 DEFINE_SHOW_ATTRIBUTE(mei_dbgfs_devstate);