RE: [PATCH 6/6] can: peak_usb: add ethtool interface to user defined flashed device number

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

 



Hi Marc,

endianess is handled by lower level functions (see for ex pcan_usb_fd_get_user_devid()/pcan_usb_fd_set_user_devid() in PATCH 2/6).

This data is really a number and must be treated as such. The "ethtool -e" interface only displays a silly memory dump not very practical to read a number (especially a 32-bit one), requiring the use of hexdump such as:

ethtool -e can1 raw on | hexdump -v -e '1 "%u\n"'

to have a usable display. Unfortunately, these formats do not take endianess into account (AFAIK). Maybe you know another way?

Regards,


— Stéphane


            De: Marc Kleine-Budde
Envoyé: Lundi 31 janvier 2022 15:31
À: Stéphane Grosjean
Cc: linux-can Mailing List
Objet: Re: [PATCH 6/6] can: peak_usb: add ethtool interface to user defined flashed device number




On 31.01.2022 14:25:28, Stéphane Grosjean wrote:

> >> +     u32 devid;

> >>

> >> +             memcpy(data, (u8 *)&devid + eeprom->offset, eeprom->len);

> >

> > cast not needed.

> >

>

> We need to cast the u32 * into a u8 * because eeprom->offset is a count of bytes, isn't it?



Doh! right.



What about endianness? I think it's better to use an array of bytes

everywhere.



Marc



--

Pengutronix e.K.                 | Marc Kleine-Budde           |

Embedded Linux                   | https://www.pengutronix.de  |

Vertretung West/Dortmund         | Phone: +49-231-2826-924     |

Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |


--
PEAK-System Technik GmbH
Sitz der Gesellschaft Darmstadt - HRB 9183
Geschaeftsfuehrung: Alexander Gach / Uwe Wilhelm
Unsere Datenschutzerklaerung mit wichtigen Hinweisen
zur Behandlung personenbezogener Daten finden Sie unter
www.peak-system.com/Datenschutz.483.0.html




[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