Re: [PATCH 01/15] net: hbl_cn: add habanalabs Core Network driver

Andrew Lunn
2024-06-17T15:02:29Z

On Mon, Jun 17, 2024 at 04:05:57PM +0200, Markus Elfring wrote:
> …
> > +++ b/drivers/net/ethernet/intel/hbl_cn/common/hbl_cn.c
> > @@ -0,0 +1,5954 @@
> …
> > +int hbl_cn_read_spmu_counters(struct hbl_cn_port *cn_port, u64 out_data[], u32 *num_out_data)
> > +{
> …
> > + mutex_lock(&cn_port->cnt_lock);
> > + rc = port_funcs->spmu_sample(cn_port, *num_out_data, out_data);
> > + mutex_unlock(&cn_port->cnt_lock);
> > +
> > + return rc;
> > +}
> …
>
> Would you become interested to apply a statement like “guard(mutex)(&cn_port->cnt_lock);”?
> https://elixir.bootlin.com/linux/v6.10-rc4/source/include/linux/mutex.h#L196

Hi Markus

We decided for netdev that guard() was too magical, at least for the
moment. Lets wait a few years to see how it pans out. scoped_guard()
is however O.K.

Andrew