[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200918130908.GA3631014@lunn.ch>
Date: Fri, 18 Sep 2020 15:09:08 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Florian Fainelli <f.fainelli@...il.com>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>, Chris Healy <cphealy@...il.com>,
Jiri Pirko <jiri@...dia.com>,
Vladimir Oltean <olteanv@...il.com>
Subject: Re: [PATCH v3 net-next 7/9] net: dsa: mv88e6xxx: Add devlink regions
> > +static int mv88e6xxx_region_global_snapshot(struct devlink *dl,
> > + const struct devlink_region_ops *ops,
> > + struct netlink_ext_ack *extack,
> > + u8 **data)
> > +{
> > + struct dsa_switch *ds = dsa_devlink_to_ds(dl);
> > + struct mv88e6xxx_chip *chip = ds->priv;
> > + u16 *registers;
> > + int i, err;
> > +
> > + registers = kmalloc_array(32, sizeof(u16), GFP_KERNEL);
> > + if (!registers)
> > + return -ENOMEM;
> > +
> > + mv88e6xxx_reg_lock(chip);
> > + for (i = 0; i < 32; i++) {
> > + switch ((long)ops->priv) {
> > + case 1:
> > + err = mv88e6xxx_g1_read(chip, i, ®isters[i]);
> > + break;
> > + case 2:
> > + err = mv88e6xxx_g1_read(chip, i, ®isters[i]);
>
> Should this be mv88e6xxx_g2_read() here?
Doh! Thanks.
> Can you use the region IDs you defined above?
Yes. That would be more readable. I probably need to make ops->priv
point to a real structure, to avoid compiler warnings about down
sizing types on casts.
Andrew
Powered by blists - more mailing lists