From: Mattias Forsblad <mattias.forsblad@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org, Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH net-next v7 4/6] net: dsa: mv88e6xxxx: Add RMU functionality.
Date: Fri, 9 Sep 2022 08:05:20 +0200 [thread overview]
Message-ID: <6abb67fe-7544-b8b6-f136-dd52e4a512a9@gmail.com> (raw)
In-Reply-To: <YxqYjoZeGhYIZ29b@lunn.ch>
On 2022-09-09 03:36, Andrew Lunn wrote:
>> +
>> + dsa_switch_inband_complete(ds, NULL);
>> +}
>> +
>> +int mv88e6xxx_rmu_setup(struct mv88e6xxx_chip *chip)
>> +{
>> + mutex_init(&chip->rmu.mutex);
>> +
>> + /* Remember original ops for restore */
>> + chip->rmu.smi_ops = chip->smi_ops;
>> +
>> + /* Change rmu ops with our own pointer */
>> + chip->rmu.rmu_ops = (struct mv88e6xxx_bus_ops *)chip->rmu.smi_ops;
>
> Why do you need a cast? In general, casts are wrong, it suggests your
> types are wrong.
>
So we want want to have the original ops from chip->smi_ops as
we cannot know which ones they are (mv88e6xxx_smi_dual_direct_ops/
mv88e6xxx_smi_direct_ops/mv88e6xxx_smi_indirect_ops). This is to be
able to restore them when appropriate. They are declared const.
But we want to replace get_rmon in our own version of ops
with mv88e6xxx_rmu_stats_get, hence that version cannot be const.
/Mattias
>> + chip->rmu.rmu_ops->get_rmon = mv88e6xxx_rmu_stats_get;
>> +
>> + if (chip->info->ops->rmu_disable)
>> + return chip->info->ops->rmu_disable(chip);
>
> Why is a setup function calling disable?
>
> Andrew
next prev parent reply other threads:[~2022-09-09 6:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 13:21 [PATCH net-next v7 0/6] net: dsa: qca8k, mv88e6xxx: rmon: Add RMU support Mattias Forsblad
2022-09-08 13:21 ` [PATCH net-next v7 1/6] net: dsa: mv88e6xxx: Add RMU enable for select switches Mattias Forsblad
2022-09-08 23:10 ` Andrew Lunn
2022-09-08 13:21 ` [PATCH net-next v7 2/6] net: dsa: Add convenience functions for frame handling Mattias Forsblad
2022-09-08 13:21 ` [PATCH net-next v7 3/6] net: dsa: Introduce dsa tagger data operation Mattias Forsblad
2022-09-08 13:21 ` [PATCH net-next v7 4/6] net: dsa: mv88e6xxxx: Add RMU functionality Mattias Forsblad
2022-09-09 1:36 ` Andrew Lunn
2022-09-09 6:05 ` Mattias Forsblad [this message]
2022-09-09 6:37 ` Mattias Forsblad
2022-09-11 13:53 ` Vladimir Oltean
2022-09-09 7:49 ` Mattias Forsblad
2022-09-08 13:21 ` [PATCH net-next v7 5/6] net: dsa: mv88e6xxx: rmon: Use RMU for reading RMON data Mattias Forsblad
2022-09-09 1:49 ` Andrew Lunn
2022-09-09 7:36 ` Mattias Forsblad
2022-09-08 13:21 ` [PATCH net-next v7 6/6] net: dsa: qca8k: Use new convenience functions Mattias Forsblad
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=6abb67fe-7544-b8b6-f136-dd52e4a512a9@gmail.com \
--to=mattias.forsblad@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@gmail.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).