[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKh2mn7Bzii+ZCpBQtcyVfksAbLcjhZ0p7+oabfCG7-DV-6Cng@mail.gmail.com>
Date: Mon, 10 Dec 2012 09:16:22 +0000
From: Steve Glendinning <steve@...well.net>
To: David Laight <David.Laight@...lab.com>
Cc: netdev <netdev@...r.kernel.org>, David Miller <davem@...emloft.net>
Subject: Re: [PATCH 5/5] smsc95xx: expand check_ macros
On 3 December 2012 10:41, David Laight <David.Laight@...lab.com> wrote:
>> - check_warn_return(ret, "Error reading MII_ACCESS\n");
>> + if (ret < 0) {
>> + netdev_warn(dev->net, "Error reading MII_ACCESS\n");
>> + return ret;
>> + }
>> +
>
> It might be worth defining something like:
>
> #define check_warn(dev, ret, errmsg) \
> (ret >= 0 ? 0 : (netdev_warn(dev->net, errmsg), ret))
>
> so the above code can be:
> if (check_warn(dev, ret, "Error reading MII_ACCESS\n"))
> return ret;
>
Thanks David, I'd rather not define this kind of macro locally though.
I'm happy to use something like this but only if it's something
that's centrally defined, blessed by davem, and if it's something that
all drivers are intended to use. Otherwise we end up with subtly
different macros in different drivers, and subtly different behaviours
in each.
Steve
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists