Re: [net-next v5 07/15] net/mlx5: SF, Add auxiliary device support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 15 Dec 2020 01:03:50 -0800 Saeed Mahameed wrote:
> +static ssize_t sfnum_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> +	struct auxiliary_device *adev = container_of(dev, struct auxiliary_device, dev);
> +	struct mlx5_sf_dev *sf_dev = container_of(adev, struct mlx5_sf_dev, adev);
> +
> +	return scnprintf(buf, PAGE_SIZE, "%u\n", sf_dev->sfnum);
> +}
> +static DEVICE_ATTR_RO(sfnum);
> +
> +static struct attribute *sf_device_attrs[] = {
> +	&dev_attr_sfnum.attr,
> +	NULL,
> +};
> +
> +static const struct attribute_group sf_attr_group = {
> +	.attrs = sf_device_attrs,
> +};
> +
> +static const struct attribute_group *sf_attr_groups[2] = {
> +	&sf_attr_group,
> +	NULL
> +};

Why the sysfs attribute? Devlink should be able to report device name
so there's no need for a tie in from the other end.



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux