From: Sean Anderson <seanga2@gmail.com>
To: Simon Horman <simon.horman@corigine.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 6/9] net: sunhme: Consolidate mac address initialization
Date: Sat, 18 Mar 2023 11:31:17 -0400 [thread overview]
Message-ID: <12926ee8-ee35-791f-d7a5-943cdf744d46@gmail.com> (raw)
In-Reply-To: <ZBV9M28EhKFYrHnc@corigine.com>
On 3/18/23 04:58, Simon Horman wrote:
> On Mon, Mar 13, 2023 at 08:36:10PM -0400, Sean Anderson wrote:
>> The mac address initialization is braodly the same between PCI and SBUS,
>> and one was clearly copied from the other. Consolidate them. We still have
>> to have some ifdefs because pci_(un)map_rom is only implemented for PCI,
>> and idprom is only implemented for SPARC.
>>
>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>
> Hi Sean,
>
> Nits aside, this looks good to me.
>
> Reviewed-by: Simon Horman <simon.horman@corigine.com>
>
>> diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
>> index 3072578c334a..c2737f26afbe 100644
>> --- a/drivers/net/ethernet/sun/sunhme.c
>> +++ b/drivers/net/ethernet/sun/sunhme.c
>
> ...
>
>> +static void __maybe_unused get_hme_mac_nonsparc(struct pci_dev *pdev,
>> + unsigned char *dev_addr)
>> +{
>> + size_t size;
>> + void __iomem *p = pci_map_rom(pdev, &size);
>
> nit: reverse xmas tree - longest line to shortest - would be nice here.
>
> void __iomem *p;
> size_t size;
>
> p = pci_map_rom(pdev, &size);
>
>> +
>> + if (p) {
>> + int index = 0;
>> + int found;
>> +
>> + if (is_quattro_p(pdev))
>> + index = PCI_SLOT(pdev->devfn);
>> +
>> + found = readb(p) == 0x55 &&
>> + readb(p + 1) == 0xaa &&
>> + find_eth_addr_in_vpd(p, (64 * 1024), index, dev_addr);
>> + pci_unmap_rom(pdev, p);
>> + if (found)
>> + return;
>> + }
>> +
>> + /* Sun MAC prefix then 3 random bytes. */
>> + dev_addr[0] = 0x08;
>> + dev_addr[1] = 0x00;
>> + dev_addr[2] = 0x20;
>> + get_random_bytes(&dev_addr[3], 3);
>
> nit: Maybe as a follow-up using eth_hw_addr_random() could be considered here.
Yes, I would like to come back to this later.
>> +}
>> +#endif /* !(CONFIG_SPARC) */
>
> ...
>
>> static int happy_meal_pci_probe(struct pci_dev *pdev,
>> const struct pci_device_id *ent)
>> {
>> struct quattro *qp = NULL;
>> -#ifdef CONFIG_SPARC
>> - struct device_node *dp;
>> -#endif
>> + struct device_node *dp = NULL;
>
> nit: if dp was added above qp then then
> things would move closer to reverse xmas tree.
>
>> struct happy_meal *hp;
>> struct net_device *dev;
>> void __iomem *hpreg_base;
>> struct resource *hpreg_res;
>> - int i, qfe_slot = -1;
>> + int qfe_slot = -1;
>
> nit: if qfe_slot was added below prom_name[64] then then
> things would move closer to reverse xmas tree.
This is why I dislike this style...
>> char prom_name[64];
>> - u8 addr[ETH_ALEN];
>> int err;
>>
>> /* Now make sure pci_dev cookie is there. */
>
> ...
next prev parent reply other threads:[~2023-03-18 15:31 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-14 0:36 [PATCH net-next v3 0/9] net: sunhme: Probe/IRQ cleanups Sean Anderson
2023-03-14 0:36 ` [PATCH net-next v3 1/9] net: sunhme: Just restart autonegotiation if we can't bring the link up Sean Anderson
2023-03-15 8:20 ` Simon Horman
2023-03-15 15:35 ` Sean Anderson
2023-03-15 15:57 ` Simon Horman
2023-03-15 15:58 ` Simon Horman
2023-03-18 8:37 ` Simon Horman
2023-03-18 14:31 ` Sean Anderson
2023-03-14 0:36 ` [PATCH net-next v3 2/9] net: sunhme: Remove residual polling code Sean Anderson
2023-03-15 15:58 ` Simon Horman
2023-03-14 0:36 ` [PATCH net-next v3 3/9] net: sunhme: Unify IRQ requesting Sean Anderson
2023-03-15 15:59 ` Simon Horman
2023-03-14 0:36 ` [PATCH net-next v3 4/9] net: sunhme: Alphabetize includes Sean Anderson
2023-03-15 15:59 ` Simon Horman
2023-03-14 0:36 ` [PATCH net-next v3 5/9] net: sunhme: Switch SBUS to devres Sean Anderson
2023-03-18 8:23 ` Simon Horman
2023-03-14 0:36 ` [PATCH net-next v3 6/9] net: sunhme: Consolidate mac address initialization Sean Anderson
2023-03-18 8:58 ` Simon Horman
2023-03-18 9:00 ` Simon Horman
2023-03-18 15:31 ` Sean Anderson [this message]
2023-03-14 0:36 ` [PATCH net-next v3 7/9] net: sunhme: Clean up mac address init Sean Anderson
2023-03-18 9:03 ` Simon Horman
2023-03-18 15:43 ` Sean Anderson
2023-03-21 8:01 ` Simon Horman
2023-03-14 0:36 ` [PATCH net-next v3 8/9] net: sunhme: Inline error returns Sean Anderson
2023-03-15 7:51 ` Jakub Kicinski
2023-03-15 15:36 ` Sean Anderson
2023-03-18 13:49 ` Simon Horman
2023-03-14 0:36 ` [PATCH net-next v3 9/9] net: sunhme: Consolidate common probe tasks Sean Anderson
2023-03-18 13:53 ` Simon Horman
2023-03-18 14:40 ` Sean Anderson
2023-03-21 8:00 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12926ee8-ee35-791f-d7a5-943cdf744d46@gmail.com \
--to=seanga2@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=simon.horman@corigine.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).