Matthias Fuchs wrote:
> Hi Marc,
>
> On Tuesday 22 December 2009 15:43, Marc Kleine-Budde wrote:
> ...
>>> +}
>>> +
>>> +static int esd_usb2_close(struct net_device *netdev)
>>> +{
>>> + struct esd_usb2_net *net = netdev_priv(netdev);
>>> + int i;
>>> + struct esd_usb2_msg msg;
>>> +
>>> + /* Disable all IDs */
>>> + msg.msg.hdr.cmd = CMD_IDADD;
>>> + msg.msg.hdr.len = 1 + 64 + 1;
>>> + msg.msg.filter.net = net->index;
>>> + msg.msg.filter.option = ESD_ID_ENABLE; /* start with segment 0 */
>>> + for (i = 0; i < 64; i++)
>>> + msg.msg.filter.mask[i] = 0;
>>> + msg.msg.filter.mask[64] = 0;
>> you might want to use C99 initializer for msg.
> msg is reused for a 2nd message below. So I could initialize it
> on declaration for the first usage and leave the code for the 2nd
> message as is. I think this does not make the cody any better, right?
> Or do you mean anything different? I vote for leaving this sequence untouched.sounds good..... another option might be to define a second message, and not reusing the 1st one, but this will perhaps increase the size of the kernel. (which can be checked with "scripts/bloat-o-meter" >>> + esd_usb2_send_msg(net->usb2, &msg); >>> + >>> + /* set CAN controller to reset mode */ >>> + msg.msg.setbaud.len = 2; >>> + msg.msg.setbaud.cmd = CMD_SETBAUD; >>> + msg.msg.setbaud.net = net->index; >>> + msg.msg.setbaud.rsvd = 0; >>> + msg.msg.setbaud.baud = cpu_to_le32(ESD_NO_BAUDRATE); >>> + esd_usb2_send_msg(net->usb2, &msg); >>> + >>> + netif_stop_queue(netdev); >>> + >>> + close_candev(netdev); >>> + >>> + net->open_time = 0; >>> + >>> + return 0; >>> +} >>> + > > Matthias 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
