mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [char-misc-next 0/5] mei: cleanup some checkpatch issues
@ 2014-03-16 12:35 Tomas Winkler
  2014-03-16 12:35 ` [char-misc-next 1/5] mei: fix Unnecessary space after function pointer name Tomas Winkler
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Tomas Winkler @ 2014-03-16 12:35 UTC (permalink / raw)
  To: gregkh; +Cc: arnd, linux-kernel, Tomas Winkler

Tomas Winkler (5):
  mei: fix Unnecessary space after function pointer name
  mei: use cl_dbg where appropriate
  mei: client.h fix checkpetch errors
  mei: amthif: fix checkpatch error
  mei: don't use deprecated DEFINE_PCI_DEVICE_TABLE macro

 drivers/misc/mei/amthif.c  |  3 +--
 drivers/misc/mei/client.h  |  8 ++++----
 drivers/misc/mei/hbm.c     |  3 +--
 drivers/misc/mei/main.c    | 10 ++--------
 drivers/misc/mei/mei_dev.h | 24 ++++++++++++------------
 drivers/misc/mei/pci-me.c  |  2 +-
 drivers/misc/mei/pci-txe.c |  2 +-
 7 files changed, 22 insertions(+), 30 deletions(-)

-- 
1.8.5.3


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

* [char-misc-next 1/5] mei: fix Unnecessary space after function pointer name
  2014-03-16 12:35 [char-misc-next 0/5] mei: cleanup some checkpatch issues Tomas Winkler
@ 2014-03-16 12:35 ` Tomas Winkler
  2014-03-16 12:35 ` [char-misc-next 2/5] mei: use cl_dbg where appropriate Tomas Winkler
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Tomas Winkler @ 2014-03-16 12:35 UTC (permalink / raw)
  To: gregkh; +Cc: arnd, linux-kernel, Tomas Winkler

Fix checkpatch warining:
Unnecessary space after function pointer name

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/mei_dev.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index 2ef5593..94a5167 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -237,20 +237,20 @@ struct mei_cl {
  */
 struct mei_hw_ops {
 
-	bool (*host_is_ready) (struct mei_device *dev);
+	bool (*host_is_ready)(struct mei_device *dev);
 
-	bool (*hw_is_ready) (struct mei_device *dev);
-	int (*hw_reset) (struct mei_device *dev, bool enable);
-	int  (*hw_start) (struct mei_device *dev);
-	void (*hw_config) (struct mei_device *dev);
+	bool (*hw_is_ready)(struct mei_device *dev);
+	int (*hw_reset)(struct mei_device *dev, bool enable);
+	int (*hw_start)(struct mei_device *dev);
+	void (*hw_config)(struct mei_device *dev);
 
-	void (*intr_clear) (struct mei_device *dev);
-	void (*intr_enable) (struct mei_device *dev);
-	void (*intr_disable) (struct mei_device *dev);
+	void (*intr_clear)(struct mei_device *dev);
+	void (*intr_enable)(struct mei_device *dev);
+	void (*intr_disable)(struct mei_device *dev);
 
-	int (*hbuf_free_slots) (struct mei_device *dev);
-	bool (*hbuf_is_ready) (struct mei_device *dev);
-	size_t (*hbuf_max_len) (const struct mei_device *dev);
+	int (*hbuf_free_slots)(struct mei_device *dev);
+	bool (*hbuf_is_ready)(struct mei_device *dev);
+	size_t (*hbuf_max_len)(const struct mei_device *dev);
 
 	int (*write)(struct mei_device *dev,
 		     struct mei_msg_hdr *hdr,
@@ -259,7 +259,7 @@ struct mei_hw_ops {
 	int (*rdbuf_full_slots)(struct mei_device *dev);
 
 	u32 (*read_hdr)(const struct mei_device *dev);
-	int (*read) (struct mei_device *dev,
+	int (*read)(struct mei_device *dev,
 		     unsigned char *buf, unsigned long len);
 };
 
-- 
1.8.5.3


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

* [char-misc-next 2/5] mei: use cl_dbg where appropriate
  2014-03-16 12:35 [char-misc-next 0/5] mei: cleanup some checkpatch issues Tomas Winkler
  2014-03-16 12:35 ` [char-misc-next 1/5] mei: fix Unnecessary space after function pointer name Tomas Winkler
@ 2014-03-16 12:35 ` Tomas Winkler
  2014-03-16 16:36   ` Joe Perches
  2014-03-16 12:35 ` [char-misc-next 3/5] mei: client.h fix checkpetch errors Tomas Winkler
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Tomas Winkler @ 2014-03-16 12:35 UTC (permalink / raw)
  To: gregkh; +Cc: arnd, linux-kernel, Tomas Winkler

use cl_dbg for debug log messages in cl context

this also removes checkpatch warning:
quoted string split across lines

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/hbm.c  |  3 +--
 drivers/misc/mei/main.c | 10 ++--------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
index 5fa5ff9..4960288 100644
--- a/drivers/misc/mei/hbm.c
+++ b/drivers/misc/mei/hbm.c
@@ -329,8 +329,7 @@ int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl)
 	mei_hbm_hdr(mei_hdr, len);
 	mei_hbm_cl_hdr(cl, MEI_FLOW_CONTROL_CMD, dev->wr_msg.data, len);
 
-	dev_dbg(&dev->pdev->dev, "sending flow control host client = %d, ME client = %d\n",
-		cl->host_client_id, cl->me_client_id);
+	cl_dbg(dev, cl, "sending flow control\n");
 
 	return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
 }
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index bc1c39e..b35594d 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -125,17 +125,11 @@ static int mei_release(struct inode *inode, struct file *file)
 	}
 	if (cl->state == MEI_FILE_CONNECTED) {
 		cl->state = MEI_FILE_DISCONNECTING;
-		dev_dbg(&dev->pdev->dev,
-			"disconnecting client host client = %d, "
-		    "ME client = %d\n",
-		    cl->host_client_id,
-		    cl->me_client_id);
+		cl_dbg(dev, cl, "disconnecting\n");
 		rets = mei_cl_disconnect(cl);
 	}
 	mei_cl_flush_queues(cl);
-	dev_dbg(&dev->pdev->dev, "remove client host client = %d, ME client = %d\n",
-	    cl->host_client_id,
-	    cl->me_client_id);
+	cl_dbg(dev, cl, "removing\n");
 
 	mei_cl_unlink(cl);
 
-- 
1.8.5.3


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

* [char-misc-next 3/5] mei: client.h fix checkpetch errors
  2014-03-16 12:35 [char-misc-next 0/5] mei: cleanup some checkpatch issues Tomas Winkler
  2014-03-16 12:35 ` [char-misc-next 1/5] mei: fix Unnecessary space after function pointer name Tomas Winkler
  2014-03-16 12:35 ` [char-misc-next 2/5] mei: use cl_dbg where appropriate Tomas Winkler
@ 2014-03-16 12:35 ` Tomas Winkler
  2014-03-16 12:35 ` [char-misc-next 4/5] mei: amthif: fix checkpatch error Tomas Winkler
  2014-03-16 12:35 ` [char-misc-next 5/5] mei: don't use deprecated DEFINE_PCI_DEVICE_TABLE macro Tomas Winkler
  4 siblings, 0 replies; 9+ messages in thread
From: Tomas Winkler @ 2014-03-16 12:35 UTC (permalink / raw)
  To: gregkh; +Cc: arnd, linux-kernel, Tomas Winkler

Fix checkpatch error
return is not a function, parentheses are not required

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/client.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h
index 8139393..96d5de0 100644
--- a/drivers/misc/mei/client.h
+++ b/drivers/misc/mei/client.h
@@ -68,15 +68,15 @@ int mei_cl_flow_ctrl_reduce(struct mei_cl *cl);
  */
 static inline bool mei_cl_is_connected(struct mei_cl *cl)
 {
-	return (cl->dev &&
+	return  cl->dev &&
 		cl->dev->dev_state == MEI_DEV_ENABLED &&
-		cl->state == MEI_FILE_CONNECTED);
+		cl->state == MEI_FILE_CONNECTED;
 }
 static inline bool mei_cl_is_transitioning(struct mei_cl *cl)
 {
-	return (MEI_FILE_INITIALIZING == cl->state ||
+	return  MEI_FILE_INITIALIZING == cl->state ||
 		MEI_FILE_DISCONNECTED == cl->state ||
-		MEI_FILE_DISCONNECTING == cl->state);
+		MEI_FILE_DISCONNECTING == cl->state;
 }
 
 bool mei_cl_is_other_connecting(struct mei_cl *cl);
-- 
1.8.5.3


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

* [char-misc-next 4/5] mei: amthif: fix checkpatch error
  2014-03-16 12:35 [char-misc-next 0/5] mei: cleanup some checkpatch issues Tomas Winkler
                   ` (2 preceding siblings ...)
  2014-03-16 12:35 ` [char-misc-next 3/5] mei: client.h fix checkpetch errors Tomas Winkler
@ 2014-03-16 12:35 ` Tomas Winkler
  2014-03-16 12:35 ` [char-misc-next 5/5] mei: don't use deprecated DEFINE_PCI_DEVICE_TABLE macro Tomas Winkler
  4 siblings, 0 replies; 9+ messages in thread
From: Tomas Winkler @ 2014-03-16 12:35 UTC (permalink / raw)
  To: gregkh; +Cc: arnd, linux-kernel, Tomas Winkler

ERROR: else should follow close brace '}'
+	}
+	else {

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/amthif.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index 2052609..b8deb34 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -247,8 +247,7 @@ int mei_amthif_read(struct mei_device *dev, struct file *file,
 	if (copy_to_user(ubuf, cb->response_buffer.data + *offset, length)) {
 		dev_dbg(&dev->pdev->dev, "failed to copy data to userland\n");
 		rets = -EFAULT;
-	}
-	else {
+	} else {
 		rets = length;
 		if ((*offset + length) < cb->buf_idx) {
 			*offset += length;
-- 
1.8.5.3


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

* [char-misc-next 5/5] mei: don't use deprecated DEFINE_PCI_DEVICE_TABLE macro
  2014-03-16 12:35 [char-misc-next 0/5] mei: cleanup some checkpatch issues Tomas Winkler
                   ` (3 preceding siblings ...)
  2014-03-16 12:35 ` [char-misc-next 4/5] mei: amthif: fix checkpatch error Tomas Winkler
@ 2014-03-16 12:35 ` Tomas Winkler
  4 siblings, 0 replies; 9+ messages in thread
From: Tomas Winkler @ 2014-03-16 12:35 UTC (permalink / raw)
  To: gregkh; +Cc: arnd, linux-kernel, Tomas Winkler

Using struct pci_device_id is preferred  over
deprecated DEFINE_PCI_DEVICE_TABLE macro

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
---
 drivers/misc/mei/pci-me.c  | 2 +-
 drivers/misc/mei/pci-txe.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index 135ea06..1c8fd3a 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -41,7 +41,7 @@
 #include "hw-me.h"
 
 /* mei_pci_tbl - PCI Device ID Table */
-static DEFINE_PCI_DEVICE_TABLE(mei_me_pci_tbl) = {
+static const struct pci_device_id mei_me_pci_tbl[] = {
 	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_82946GZ)},
 	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_82G35)},
 	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_82Q965)},
diff --git a/drivers/misc/mei/pci-txe.c b/drivers/misc/mei/pci-txe.c
index a5bf39a..ad3adb0 100644
--- a/drivers/misc/mei/pci-txe.c
+++ b/drivers/misc/mei/pci-txe.c
@@ -34,7 +34,7 @@
 #include "mei_dev.h"
 #include "hw-txe.h"
 
-static DEFINE_PCI_DEVICE_TABLE(mei_txe_pci_tbl) = {
+static const struct pci_device_id mei_txe_pci_tbl[] = {
 	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0F18)}, /* Baytrail */
 	{0, }
 };
-- 
1.8.5.3


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

* Re: [char-misc-next 2/5] mei: use cl_dbg where appropriate
  2014-03-16 12:35 ` [char-misc-next 2/5] mei: use cl_dbg where appropriate Tomas Winkler
@ 2014-03-16 16:36   ` Joe Perches
  2014-03-16 22:19     ` Winkler, Tomas
  0 siblings, 1 reply; 9+ messages in thread
From: Joe Perches @ 2014-03-16 16:36 UTC (permalink / raw)
  To: Tomas Winkler; +Cc: gregkh, arnd, linux-kernel

On Sun, 2014-03-16 at 14:35 +0200, Tomas Winkler wrote:
> use cl_dbg for debug log messages in cl context

I think all the uses of cl_dbg and cl_err are odd.

from: client.h

#define cl_dbg(dev, cl, format, arg...) \
	dev_dbg(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)

#define cl_err(dev, cl, format, arg...) \
	dev_err(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)

dev is always passed separately from cl but
dev is set like:

	struct mei_device *dev;
[]
	dev = cl->dev;

So I think these should be converted to:

#define cl_dbg(cl, format, ...) \
	dev_dbg(&(cl)->dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##__VA_ARGS__)

and the uses from (as an example):

client.c:942:			cl_dbg(dev, cl, "Waking up reading client!\n");

to

client.c:942:			cl_dbg(cl, "Waking up reading client!\n");

This can also remove some used once declarations of dev


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

* RE: [char-misc-next 2/5] mei: use cl_dbg where appropriate
  2014-03-16 16:36   ` Joe Perches
@ 2014-03-16 22:19     ` Winkler, Tomas
  2014-03-16 23:09       ` Joe Perches
  0 siblings, 1 reply; 9+ messages in thread
From: Winkler, Tomas @ 2014-03-16 22:19 UTC (permalink / raw)
  To: Joe Perches; +Cc: gregkh, arnd, linux-kernel

> 
> On Sun, 2014-03-16 at 14:35 +0200, Tomas Winkler wrote:
> > use cl_dbg for debug log messages in cl context
> 
> I think all the uses of cl_dbg and cl_err are odd.
> 
> from: client.h
> 
> #define cl_dbg(dev, cl, format, arg...) \
> 	dev_dbg(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl),
> ##arg)
> 
> #define cl_err(dev, cl, format, arg...) \
> 	dev_err(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
> 
> dev is always passed separately from cl but
> dev is set like:
> 
> 	struct mei_device *dev;
> []
> 	dev = cl->dev;
> 
> So I think these should be converted to:
> 
> #define cl_dbg(cl, format, ...) \
> 	dev_dbg(&(cl)->dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl),
> ##__VA_ARGS__)
> 
> and the uses from (as an example):
> 
> client.c:942:			cl_dbg(dev, cl, "Waking up reading client!\n");
> 
> to
> 
> client.c:942:			cl_dbg(cl, "Waking up reading client!\n");
> 
> This can also remove some used once declarations of dev

Yes, I'm aware of this, at the time I've preferred consistently passing dev as a first argument. 
It can be changed I just  personally  don't feel some big gain.

Tomas




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

* Re: [char-misc-next 2/5] mei: use cl_dbg where appropriate
  2014-03-16 22:19     ` Winkler, Tomas
@ 2014-03-16 23:09       ` Joe Perches
  0 siblings, 0 replies; 9+ messages in thread
From: Joe Perches @ 2014-03-16 23:09 UTC (permalink / raw)
  To: Winkler, Tomas; +Cc: gregkh, arnd, linux-kernel

On Sun, 2014-03-16 at 22:19 +0000, Winkler, Tomas wrote:
> > #define cl_dbg(dev, cl, format, arg...) \
> > 	dev_dbg(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl),
> > ##arg)
[]
> > #define cl_dbg(cl, format, ...) \
> > 	dev_dbg(&(cl)->dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl),
> > ##__VA_ARGS__)
[]
> Yes, I'm aware of this, at the time I've preferred consistently passing dev as a first argument. 
> It can be changed I just  personally  don't feel some big gain.

I do wonder about the mixture of dev_dbg and cl_dbg.
Was there any rationale about this mixture?

Here's a potential cleanup

From: Joe Perches <joe@perches.com>
Date: Sun, 16 Mar 2014 15:55:06 -0700
Subject: [PATCH] mei: Remove unnecessary dev arg from cl_<level> logging

dev is a member of cl so use that instead.

Add missing newlines.
Neaten logging messages and alignment.
Remove now unnecessary declaration too.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/misc/mei/amthif.c    |  2 +-
 drivers/misc/mei/client.c    | 53 +++++++++++++++++++-------------------------
 drivers/misc/mei/client.h    | 16 ++++++++-----
 drivers/misc/mei/hbm.c       |  4 ++--
 drivers/misc/mei/interrupt.c | 20 ++++++++---------
 drivers/misc/mei/main.c      |  4 ++--
 drivers/misc/mei/pci-me.c    |  2 +-
 7 files changed, 50 insertions(+), 51 deletions(-)

diff --git a/drivers/misc/mei/amthif.c b/drivers/misc/mei/amthif.c
index f05d54d..7bb66c7 100644
--- a/drivers/misc/mei/amthif.c
+++ b/drivers/misc/mei/amthif.c
@@ -458,7 +458,7 @@ int mei_amthif_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
 		return rets;
 
 	if (rets == 0) {
-		cl_dbg(dev, cl, "No flow control credentials: not sending.\n");
+		cl_dbg(cl, "No flow control credentials: not sending\n");
 		return 0;
 	}
 
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c
index 7536081..a095afa 100644
--- a/drivers/misc/mei/client.c
+++ b/drivers/misc/mei/client.c
@@ -184,14 +184,10 @@ int mei_io_cb_alloc_resp_buf(struct mei_cl_cb *cb, size_t length)
  */
 int mei_cl_flush_queues(struct mei_cl *cl)
 {
-	struct mei_device *dev;
-
 	if (WARN_ON(!cl || !cl->dev))
 		return -EINVAL;
 
-	dev = cl->dev;
-
-	cl_dbg(dev, cl, "remove list entry belonging to cl\n");
+	cl_dbg(cl, "remove list entry belonging to cl\n");
 	mei_io_list_flush(&cl->dev->read_list, cl);
 	mei_io_list_flush(&cl->dev->write_list, cl);
 	mei_io_list_flush(&cl->dev->write_waiting_list, cl);
@@ -304,7 +300,7 @@ int mei_cl_link(struct mei_cl *cl, int id)
 
 	cl->state = MEI_FILE_INITIALIZING;
 
-	cl_dbg(dev, cl, "link cl\n");
+	cl_dbg(cl, "link cl\n");
 	return 0;
 }
 
@@ -327,7 +323,7 @@ int mei_cl_unlink(struct mei_cl *cl)
 
 	dev = cl->dev;
 
-	cl_dbg(dev, cl, "unlink client");
+	cl_dbg(cl, "unlink client\n");
 
 	if (dev->open_handle_count > 0)
 		dev->open_handle_count--;
@@ -409,7 +405,7 @@ int mei_cl_disconnect(struct mei_cl *cl)
 
 	dev = cl->dev;
 
-	cl_dbg(dev, cl, "disconnecting");
+	cl_dbg(cl, "disconnecting\n");
 
 	if (cl->state != MEI_FILE_DISCONNECTING)
 		return 0;
@@ -422,13 +418,13 @@ int mei_cl_disconnect(struct mei_cl *cl)
 	if (mei_hbuf_acquire(dev)) {
 		if (mei_hbm_cl_disconnect_req(dev, cl)) {
 			rets = -ENODEV;
-			cl_err(dev, cl, "failed to disconnect.\n");
+			cl_err(cl, "failed to disconnect\n");
 			goto free;
 		}
 		mdelay(10); /* Wait for hardware disconnection ready */
 		list_add_tail(&cb->list, &dev->ctrl_rd_list.list);
 	} else {
-		cl_dbg(dev, cl, "add disconnect cb to control write list\n");
+		cl_dbg(cl, "add disconnect cb to control write list\n");
 		list_add_tail(&cb->list, &dev->ctrl_wr_list.list);
 
 	}
@@ -441,17 +437,16 @@ int mei_cl_disconnect(struct mei_cl *cl)
 	mutex_lock(&dev->device_lock);
 	if (MEI_FILE_DISCONNECTED == cl->state) {
 		rets = 0;
-		cl_dbg(dev, cl, "successfully disconnected from FW client.\n");
+		cl_dbg(cl, "successfully disconnected from FW client\n");
 	} else {
 		rets = -ENODEV;
 		if (MEI_FILE_DISCONNECTED != cl->state)
-			cl_err(dev, cl, "wrong status client disconnect.\n");
+			cl_err(cl, "wrong status client disconnect\n");
 
 		if (err)
-			cl_dbg(dev, cl, "wait failed disconnect err=%08x\n",
-					err);
+			cl_dbg(cl, "wait failed disconnect err=%08x\n", err);
 
-		cl_err(dev, cl, "failed to disconnect from FW client.\n");
+		cl_err(cl, "failed to disconnect from FW client\n");
 	}
 
 	mei_io_list_flush(&dev->ctrl_rd_list, cl);
@@ -582,7 +577,7 @@ int mei_cl_flow_ctrl_creds(struct mei_cl *cl)
 
 	id = mei_me_cl_by_id(dev, cl->me_client_id);
 	if (id < 0) {
-		cl_err(dev, cl, "no such me client %d\n", cl->me_client_id);
+		cl_err(cl, "no such me client %d\n", cl->me_client_id);
 		return id;
 	}
 
@@ -618,7 +613,7 @@ int mei_cl_flow_ctrl_reduce(struct mei_cl *cl)
 
 	id = mei_me_cl_by_id(dev, cl->me_client_id);
 	if (id < 0) {
-		cl_err(dev, cl, "no such me client %d\n", cl->me_client_id);
+		cl_err(cl, "no such me client %d\n", cl->me_client_id);
 		return id;
 	}
 
@@ -658,12 +653,12 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length)
 		return -ENODEV;
 
 	if (cl->read_cb) {
-		cl_dbg(dev, cl, "read is pending.\n");
+		cl_dbg(cl, "read is pending\n");
 		return -EBUSY;
 	}
 	i = mei_me_cl_by_id(dev, cl->me_client_id);
 	if (i < 0) {
-		cl_err(dev, cl, "no such me client %d\n", cl->me_client_id);
+		cl_err(cl, "no such me client %d\n", cl->me_client_id);
 		return  -ENOTTY;
 	}
 
@@ -680,7 +675,7 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length)
 	cb->fop_type = MEI_FOP_READ;
 	if (mei_hbuf_acquire(dev)) {
 		if (mei_hbm_cl_flow_control_req(dev, cl)) {
-			cl_err(dev, cl, "flow control send failed\n");
+			cl_err(cl, "flow control send failed\n");
 			rets = -ENODEV;
 			goto err;
 		}
@@ -730,7 +725,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
 		return rets;
 
 	if (rets == 0) {
-		cl_dbg(dev, cl,	"No flow control credentials: not sending.\n");
+		cl_dbg(cl, "No flow control credentials: not sending\n");
 		return 0;
 	}
 
@@ -757,8 +752,8 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
 		return 0;
 	}
 
-	cl_dbg(dev, cl, "buf: size = %d idx = %lu\n",
-			cb->request_buffer.size, cb->buf_idx);
+	cl_dbg(cl, "buf: size = %d idx = %lu\n",
+	       cb->request_buffer.size, cb->buf_idx);
 
 	rets = mei_write_message(dev, &mei_hdr, buf->data + cb->buf_idx);
 	if (rets) {
@@ -805,11 +800,9 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
 
 	dev = cl->dev;
 
-
 	buf = &cb->request_buffer;
 
-	cl_dbg(dev, cl, "mei_cl_write %d\n", buf->size);
-
+	cl_dbg(cl, "mei_cl_write %d\n", buf->size);
 
 	cb->fop_type = MEI_FOP_WRITE;
 	cb->buf_idx = 0;
@@ -826,12 +819,12 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
 		goto err;
 
 	if (rets == 0) {
-		cl_dbg(dev, cl, "No flow control credentials: not sending.\n");
+		cl_dbg(cl, "No flow control credentials: not sending\n");
 		rets = buf->size;
 		goto out;
 	}
 	if (!mei_hbuf_acquire(dev)) {
-		cl_dbg(dev, cl, "Cannot acquire the host buffer: not sending.\n");
+		cl_dbg(cl, "Cannot acquire the host buffer: not sending\n");
 		rets = buf->size;
 		goto out;
 	}
@@ -939,11 +932,11 @@ void mei_cl_all_wakeup(struct mei_device *dev)
 	struct mei_cl *cl;
 	list_for_each_entry(cl, &dev->file_list, link) {
 		if (waitqueue_active(&cl->rx_wait)) {
-			cl_dbg(dev, cl, "Waking up reading client!\n");
+			cl_dbg(cl, "Waking up reading client!\n");
 			wake_up_interruptible(&cl->rx_wait);
 		}
 		if (waitqueue_active(&cl->tx_wait)) {
-			cl_dbg(dev, cl, "Waking up writing client!\n");
+			cl_dbg(cl, "Waking up writing client!\n");
 			wake_up_interruptible(&cl->tx_wait);
 		}
 	}
diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h
index 257aa5f..ddc9979 100644
--- a/drivers/misc/mei/client.h
+++ b/drivers/misc/mei/client.h
@@ -118,10 +118,16 @@ void mei_cl_all_write_clear(struct mei_device *dev);
 #define MEI_CL_FMT "cl:host=%02d me=%02d "
 #define MEI_CL_PRM(cl) (cl)->host_client_id, (cl)->me_client_id
 
-#define cl_dbg(dev, cl, format, arg...) \
-	dev_dbg(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
-
-#define cl_err(dev, cl, format, arg...) \
-	dev_err(&(dev)->pdev->dev, MEI_CL_FMT format, MEI_CL_PRM(cl), ##arg)
+#define cl_dbg(cl, fmt, ...)						\
+	dev_dbg(&(cl)->dev->pdev->dev,					\
+		"cl:host=%02d me=%02d " fmt,				\
+		(cl)->host_client_id, (cl)->me_client_id,		\
+		##__VA_ARGS__)
+
+#define cl_err(cl, fmt, ...)						\
+	dev_err(&(cl)->dev->pdev->dev,					\
+		"cl:host=%02d me=%02d " fmt,				\
+		(cl)->host_client_id, (cl)->me_client_id,		\
+		##__VA_ARGS__)
 
 #endif /* _MEI_CLIENT_H_ */
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
index dd7a788..a063bb4 100644
--- a/drivers/misc/mei/hbm.c
+++ b/drivers/misc/mei/hbm.c
@@ -330,7 +330,7 @@ int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl)
 	mei_hbm_hdr(mei_hdr, len);
 	mei_hbm_cl_hdr(cl, MEI_FLOW_CONTROL_CMD, dev->wr_msg.data, len);
 
-	cl_dbg(dev, cl, "sending flow control\n");
+	cl_dbg(cl, "sending flow control\n");
 
 	return mei_write_message(dev, mei_hdr, dev->wr_msg.data);
 }
@@ -570,7 +570,7 @@ static int mei_hbm_fw_disconnect_req(struct mei_device *dev,
 			if (!cb)
 				return -ENOMEM;
 			cb->fop_type = MEI_FOP_DISCONNECT_RSP;
-			cl_dbg(dev, cl, "add disconnect response as first\n");
+			cl_dbg(cl, "add disconnect response as first\n");
 			list_add(&cb->list, &dev->ctrl_wr_list.list);
 
 			break;
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index 2fbf0c0..351e568 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -113,21 +113,21 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
 
 		if (cb->response_buffer.size == 0 ||
 		    cb->response_buffer.data == NULL) {
-			cl_err(dev, cl, "response buffer is not allocated.\n");
+			cl_err(cl, "response buffer is not allocated\n");
 			list_del(&cb->list);
 			return -ENOMEM;
 		}
 
 		if (cb->response_buffer.size < mei_hdr->length + cb->buf_idx) {
-			cl_dbg(dev, cl, "message overflow. size %d len %d idx %ld\n",
-				cb->response_buffer.size,
-				mei_hdr->length, cb->buf_idx);
+			cl_dbg(cl, "message overflow. size %d len %d idx %ld\n",
+			       cb->response_buffer.size,
+			       mei_hdr->length, cb->buf_idx);
 			buffer = krealloc(cb->response_buffer.data,
 					  mei_hdr->length + cb->buf_idx,
 					  GFP_KERNEL);
 
 			if (!buffer) {
-				cl_err(dev, cl, "allocation failed.\n");
+				cl_err(cl, "allocation failed\n");
 				list_del(&cb->list);
 				return -ENOMEM;
 			}
@@ -143,8 +143,8 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,
 		if (mei_hdr->msg_complete) {
 			cl->status = 0;
 			list_del(&cb->list);
-			cl_dbg(dev, cl, "completed read length = %lu\n",
-				cb->buf_idx);
+			cl_dbg(cl, "completed read length = %lu\n",
+			       cb->buf_idx);
 			list_add_tail(&cb->list, &complete_list->list);
 		}
 		break;
@@ -369,7 +369,7 @@ int mei_irq_read_handler(struct mei_device *dev,
 	/* find recipient cl */
 	list_for_each_entry(cl, &dev->file_list, link) {
 		if (mei_cl_hbm_equal(cl, mei_hdr)) {
-			cl_dbg(dev, cl, "got a message\n");
+			cl_dbg(cl, "got a message\n");
 			break;
 		}
 	}
@@ -459,12 +459,12 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
 		if (MEI_WRITING == cl->writing_state &&
 		    cb->fop_type == MEI_FOP_WRITE &&
 		    cl != &dev->iamthif_cl) {
-			cl_dbg(dev, cl, "MEI WRITE COMPLETE\n");
+			cl_dbg(cl, "MEI WRITE COMPLETE\n");
 			cl->writing_state = MEI_WRITE_COMPLETE;
 			list_add_tail(&cb->list, &cmpl_list->list);
 		}
 		if (cl == &dev->iamthif_cl) {
-			cl_dbg(dev, cl, "check iamthif flow control.\n");
+			cl_dbg(cl, "check iamthif flow control\n");
 			if (dev->iamthif_flow_control_pending) {
 				ret = mei_amthif_irq_read(dev, &slots);
 				if (ret)
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
index 51c737f5..15c1ac2 100644
--- a/drivers/misc/mei/main.c
+++ b/drivers/misc/mei/main.c
@@ -129,11 +129,11 @@ static int mei_release(struct inode *inode, struct file *file)
 	}
 	if (cl->state == MEI_FILE_CONNECTED) {
 		cl->state = MEI_FILE_DISCONNECTING;
-		cl_dbg(dev, cl, "disconnecting\n");
+		cl_dbg(cl, "disconnecting\n");
 		rets = mei_cl_disconnect(cl);
 	}
 	mei_cl_flush_queues(cl);
-	cl_dbg(dev, cl, "removing\n");
+	cl_dbg(cl, "removing\n");
 
 	mei_cl_unlink(cl);
 
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index 50d9cb5..bd7bf00 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -43,7 +43,7 @@
 #include "client.h"
 
 /* mei_pci_tbl - PCI Device ID Table */
-static DEFINE_PCI_DEVICE_TABLE(mei_me_pci_tbl) = {
+static const struct pci_device_id mei_me_pci_tbl[] = {
 	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_82946GZ)},
 	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_82G35)},
 	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_82Q965)},
-- 
1.8.1.2.459.gbcd45b4.dirty




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

end of thread, other threads:[~2014-03-16 23:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-16 12:35 [char-misc-next 0/5] mei: cleanup some checkpatch issues Tomas Winkler
2014-03-16 12:35 ` [char-misc-next 1/5] mei: fix Unnecessary space after function pointer name Tomas Winkler
2014-03-16 12:35 ` [char-misc-next 2/5] mei: use cl_dbg where appropriate Tomas Winkler
2014-03-16 16:36   ` Joe Perches
2014-03-16 22:19     ` Winkler, Tomas
2014-03-16 23:09       ` Joe Perches
2014-03-16 12:35 ` [char-misc-next 3/5] mei: client.h fix checkpetch errors Tomas Winkler
2014-03-16 12:35 ` [char-misc-next 4/5] mei: amthif: fix checkpatch error Tomas Winkler
2014-03-16 12:35 ` [char-misc-next 5/5] mei: don't use deprecated DEFINE_PCI_DEVICE_TABLE macro Tomas Winkler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®