On 10/11/2010 11:56 AM, Wolfgang Grandegger wrote: > Hi Marc, > > On 10/11/2010 11:21 AM, Marc Kleine-Budde wrote: >> On 10/06/2010 12:53 PM, Andre B. Oliveira wrote: >>> 2010/10/6 Andre B. Oliveira <[email protected]>: >>>> And here is a driver for the Microchip MCP2515 SPI controller: >> >> The driver looks really good. Some comments inline..mainly: >> - replace the unsigned char for the spi transfer buffer by u8, >> then the casts can go away >> - implement IFF_ECHO > > So you would like to see this driver replacing the existing kernel > implementation, right? Does it include fixes and improvements posted by > other people, e.g. David Jander or Fawad Lateef? There seem to be a real > interrest for a more robust MPC251x implementation and it would be nice > if the people with that hardware at hand could help with testing and > debugging.
If the driver performs better I'd like to replace the existing driver. I
have the hardware, but .... currently no CAN cable connected to the MCP
:( Maybe on the weekend is someone in the lab.
[...]
>>> +
>>> +/*
>>> + * Write VALUE to register at address ADDR.
>>> + * Synchronous.
>>> + */
>>> +static int mcp2515_write(struct spi_device *spi, unsigned addr, unsigned
>>> value)
>>> +{
>>> + unsigned char buf[3] __attribute__((aligned(8)));
>>
>> u8, as spi_write takes an u8, and maybe C99 initializer for the array.
>>
>>> +
>>> + buf[0] = 2; /* write instruction */
>>> + buf[1] = addr; /* address */
>>> + buf[2] = value; /* data */
>>> +
>>> + return spi_write(spi, buf, 3);
>>
>> ARRAY_SIZE instead of "3"
>
> You mean "sizeof" instead of ARRAY_SIZE?
You're right we want the size in bytes, not the length of the array.
(although ARRAY_SIZE gives the same value here)
Cheers, Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Socketcan-core mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-core
