Patchwork [1/3] ssb: add missing method ssb_gige_get_macaddr

login
register
mail settings
Submitter Hauke Mehrtens
Date Jan. 12, 2013, 8:01 p.m.
Message ID <1358020905-9924-2-git-send-email-hauke@hauke-m.de>
Download mbox | patch
Permalink /patch/211551/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Hauke Mehrtens - Jan. 12, 2013, 8:01 p.m.
When CONFIG_SSB_DRIVER_GIGE is not set the header does not provide the
needed method.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 include/linux/ssb/ssb_driver_gige.h |    3 +++
 1 file changed, 3 insertions(+)
David Miller - Jan. 12, 2013, 11:32 p.m.
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sat, 12 Jan 2013 21:01:43 +0100

> When CONFIG_SSB_DRIVER_GIGE is not set the header does not provide the
> needed method.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

This isn't right.

You can't implement this function in a way that the caller cannot
determine that it didn't actually do anything.

You either have to protect calls with ifdefs or make this routine
return an error indication, in response to which the caller can
set a random ethernet address or take some other corrective action.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Büsch - Jan. 13, 2013, 9:47 a.m.
On Sat, 12 Jan 2013 15:32:11 -0800 (PST)
David Miller <davem@davemloft.net> wrote:

> From: Hauke Mehrtens <hauke@hauke-m.de>
> Date: Sat, 12 Jan 2013 21:01:43 +0100
> 
> > When CONFIG_SSB_DRIVER_GIGE is not set the header does not provide the
> > needed method.
> > 
> > Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> 
> This isn't right.
> 
> You can't implement this function in a way that the caller cannot
> determine that it didn't actually do anything.
> 
> You either have to protect calls with ifdefs or make this routine
> return an error indication, in response to which the caller can
> set a random ethernet address or take some other corrective action.

tg3 uses is_valid_ether_addr() afterwards anyway. An error code return value
could be added, but it didn't seem necessary.
Hauke Mehrtens - Jan. 13, 2013, 10:31 p.m.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/13/2013 10:47 AM, Michael Büsch wrote:
> On Sat, 12 Jan 2013 15:32:11 -0800 (PST) David Miller
> <davem@davemloft.net> wrote:
> 
>> From: Hauke Mehrtens <hauke@hauke-m.de> Date: Sat, 12 Jan 2013
>> 21:01:43 +0100
>> 
>>> When CONFIG_SSB_DRIVER_GIGE is not set the header does not
>>> provide the needed method.
>>> 
>>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> 
>> This isn't right.
>> 
>> You can't implement this function in a way that the caller
>> cannot determine that it didn't actually do anything.
>> 
>> You either have to protect calls with ifdefs or make this
>> routine return an error indication, in response to which the
>> caller can set a random ethernet address or take some other
>> corrective action.
> 
> tg3 uses is_valid_ether_addr() afterwards anyway. An error code
> return value could be added, but it didn't seem necessary.

David, I could change that function to return an error code in this
case, but this stub should never get called, because a caller should
check if this device is a ssb gige core with pdev_is_ssb_gige_core()
before and this always returns false if CONFIG_SSB_DRIVER_GIGE is not set.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQIcBAEBAgAGBQJQ8zXWAAoJEIZ0px9YPRMyFgEP/Rz1BOXwbHawvupAWKCLdhm5
UquCnygVZrsbskN63c5R4OfVXGZ6UFihbf1xKHq4IRv9UXkNdymoiCmv6sUVfkjR
FemyqRZ4QOz08cbVhb0k0nEIpVguyf16063kGo4JHIGAZc54xruMZv54uZYOfvvR
GYbTsVbkzNvW2ArVesGGYjbKHyEyOmjqW5GvjyyH72cQK+vZI8PBRC8tO9l8d3D1
pq3KnHSeOEXBbODgWC36QmcMV8EEQ4BAxJQjsABXO7KRyu0HpAu7zSEn8aGhV4ln
X1q6WMzPQIOjJhmxJUGbnJEo1s05/AjT2lIU7J7QcHN21YQqIUjWzG9lYCWcbhX/
RloFjEk/Gf80CfzJj97RCLKiJScfa8tdbvFvisDZaQVbet7Ql5nHeRSyiMTzMFKi
oivkh3gmaN/2CE8rgj5QIiL3DSzy0MY2cbTZMx3QmYAlTQ52cTT3NLRaT5RKxv3c
gAUq0EvkOZhHKo/WkBWbI/V4p4CWNhJI/wNphHuOM7lJ3kvfITXw17+/29rywkZY
pB5TwdlQBtuRUjAbXvUJmfIAZE1p4bd9+0liW+qPlpoa1d7ZOaTWPhxUg+74kvgP
rItNpGf9RAb7/A/n9XjciemihcMpEH4BjShgJVNN66+LwfbQ2ZRNGsJfyJZGcYEO
n7qAWVoPmgKihES59NtA
=1JMZ
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
index 6b05dcd..1438523 100644
--- a/include/linux/ssb/ssb_driver_gige.h
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -175,6 +175,9 @@  static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
 {
 	return 0;
 }
+static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
+{
+}
 
 #endif /* CONFIG_SSB_DRIVER_GIGE */
 #endif /* LINUX_SSB_DRIVER_GIGE_H_ */