[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A8045BD.8010803@gmail.com>
Date: Mon, 10 Aug 2009 18:07:25 +0200
From: Marcin Slusarz <marcin.slusarz@...il.com>
To: Roland Dreier <rdreier@...co.com>
CC: LKML <linux-kernel@...r.kernel.org>,
Roland Dreier <rolandd@...co.com>,
Sean Hefty <sean.hefty@...el.com>,
Hal Rosenstock <hal.rosenstock@...il.com>,
general@...ts.openfabrics.org
Subject: Re: [PATCH 10/14] infiniband: use printk_once
Roland Dreier wrote:
> > drivers/infiniband/hw/cxgb3/iwch.c | 4 +---
> > drivers/infiniband/hw/mlx4/main.c | 6 +-----
>
> > --- a/drivers/infiniband/hw/mlx4/main.c
> > +++ b/drivers/infiniband/hw/mlx4/main.c
> > @@ -540,15 +540,11 @@ static struct device_attribute *mlx4_class_attributes[] = {
> >
> > static void *mlx4_ib_add(struct mlx4_dev *dev)
> > {
> > - static int mlx4_ib_version_printed;
> > struct mlx4_ib_dev *ibdev;
> > int num_ports = 0;
> > int i;
> >
> > - if (!mlx4_ib_version_printed) {
> > - printk(KERN_INFO "%s", mlx4_ib_version);
> > - ++mlx4_ib_version_printed;
> > - }
> > + printk_once(KERN_INFO "%s", mlx4_ib_version);
> >
> > mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB)
> > num_ports++;
>
> Looks fine but there is near-identical code in
> drivers/infiniband/hw/mthca/mthca_main.c that you might as well convert
> too.
Thanks for a hint. Updated patch below.
---
From: Marcin Slusarz <marcin.slusarz@...il.com>
Date: Mon, 10 Aug 2009 18:01:49 +0200
Subject: [PATCH 10/14 v2] infiniband: use printk_once
Signed-off-by: Marcin Slusarz <marcin.slusarz@...il.com>
Cc: Roland Dreier <rolandd@...co.com>
Cc: Sean Hefty <sean.hefty@...el.com>
Cc: Hal Rosenstock <hal.rosenstock@...il.com>
Cc: general@...ts.openfabrics.org
---
drivers/infiniband/hw/cxgb3/iwch.c | 4 +---
drivers/infiniband/hw/mlx4/main.c | 6 +-----
drivers/infiniband/hw/mthca/mthca_main.c | 6 +-----
3 files changed, 3 insertions(+), 13 deletions(-)
diff --git a/drivers/infiniband/hw/cxgb3/iwch.c b/drivers/infiniband/hw/cxgb3/iwch.c
index 26fc0a4..9cc99df 100644
--- a/drivers/infiniband/hw/cxgb3/iwch.c
+++ b/drivers/infiniband/hw/cxgb3/iwch.c
@@ -105,11 +105,9 @@ static void rnic_init(struct iwch_dev *rnicp)
static void open_rnic_dev(struct t3cdev *tdev)
{
struct iwch_dev *rnicp;
- static int vers_printed;
PDBG("%s t3cdev %p\n", __func__, tdev);
- if (!vers_printed++)
- printk(KERN_INFO MOD "Chelsio T3 RDMA Driver - version %s\n",
+ printk_once(KERN_INFO MOD "Chelsio T3 RDMA Driver - version %s\n",
DRV_VERSION);
rnicp = (struct iwch_dev *)ib_alloc_device(sizeof(*rnicp));
if (!rnicp) {
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index ae3d759..0b2f77a 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -540,15 +540,11 @@ static struct device_attribute *mlx4_class_attributes[] = {
static void *mlx4_ib_add(struct mlx4_dev *dev)
{
- static int mlx4_ib_version_printed;
struct mlx4_ib_dev *ibdev;
int num_ports = 0;
int i;
- if (!mlx4_ib_version_printed) {
- printk(KERN_INFO "%s", mlx4_ib_version);
- ++mlx4_ib_version_printed;
- }
+ printk_once(KERN_INFO "%s", mlx4_ib_version);
mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_IB)
num_ports++;
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c
index 13da9f1..2e4e043 100644
--- a/drivers/infiniband/hw/mthca/mthca_main.c
+++ b/drivers/infiniband/hw/mthca/mthca_main.c
@@ -1215,15 +1215,11 @@ int __mthca_restart_one(struct pci_dev *pdev)
static int __devinit mthca_init_one(struct pci_dev *pdev,
const struct pci_device_id *id)
{
- static int mthca_version_printed = 0;
int ret;
mutex_lock(&mthca_device_mutex);
- if (!mthca_version_printed) {
- printk(KERN_INFO "%s", mthca_version);
- ++mthca_version_printed;
- }
+ printk_once(KERN_INFO "%s", mthca_version);
if (id->driver_data >= ARRAY_SIZE(mthca_hca_table)) {
printk(KERN_ERR PFX "%s has invalid driver data %lx\n",
--
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists