Re: [PATCH net-next 0/14] pull-request: can-next 2022-10-31

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

 



On Fri, Nov 04, 2022 at 02:08:57PM +0100, Marc Kleine-Budde wrote:
> On 01.11.2022 06:06:13, Greg Kroah-Hartman wrote:
> > Also, the line:
> > 
> > +	.attrs	= (struct attribute **)peak_usb_sysfs_attrs,
> > 
> > Is odd, there should never be a need to cast anything like this if you
> > are doing things properly.
> 
> After marking the struct attribute not as const, we can remove the cast:
> 
> | --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c
> | +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c
> | @@ -64,14 +64,14 @@ static ssize_t user_devid_show(struct device *dev, struct device_attribute *attr
> |  }
> |  static DEVICE_ATTR_RO(user_devid);
> |  
> | -static const struct attribute *peak_usb_sysfs_attrs[] = {
> | +static struct attribute *peak_usb_sysfs_attrs[] = {

Ah.  Yeah, I would love to make this a const pointer, but people do some
pretty crazy dynamic stuff with attribute groups at times, so that it
will not always work.

I have a long series of patches I'm working on that add more const
markings to the kobject and then the driver core apis, I'll add this
type of thing to the idea list as what to work on next.

thanks,

greg k-h



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux