Re: [PATCH net-next v2 1/4] can: cc770: add driver core for the Bosch CC770 and Intel AN82527
From: Marc Kleine-Budde <hidden>
Date: 2011-11-28 14:01:01
Also in:
linux-can
On 11/28/2011 02:52 PM, Wolfgang Grandegger wrote: [...]
quoted
quoted
+/* + * This driver uses the last 5 message objects 11..15. The definitions + * and structure below allows to configure and assign them to the real + * message object. + */ +static unsigned char cc770_obj_flags[CC770_OBJ_MAX] = { + [CC770_OBJ_RX0] = CC770_OBJ_FLAG_RX, + [CC770_OBJ_RX1] = CC770_OBJ_FLAG_RX | CC770_OBJ_FLAG_EFF, + [CC770_OBJ_RX_RTR0] = CC770_OBJ_FLAG_RX | CC770_OBJ_FLAG_RTR, + [CC770_OBJ_RX_RTR1] = CC770_OBJ_FLAG_RX | CC770_OBJ_FLAG_RTR | + CC770_OBJ_FLAG_EFF, + [CC770_OBJ_TX] = 0, +};Is is worth the trouble making this a per device instance option? In a OF-Tree world should this become an "attribute" (or what's the correct of-tree word for it?)Well, only msg object 15 does have double buffering and should therefore be used for bulk data reception. Therefore we have for the i82527 the module parameter: MODULE_PARM_DESC(msgobj15_eff, "Extended 29-bit frames for message object 15 " "(default: 11-bit standard frames)"); For TX we currently use just one object. Anyway, the device tree is not the right place to define such parameters because it's too static. The user may want to select it at runtime depending on the application, if at all. We can change it when there is a *real* requirement.
Fine with me.
quoted
quoted
+ for (o = 0; o < CC770_OBJ_MAX; o++) {^^^^^^^^^^^^^ what about ARRAY_SIZE(priv->obj_flags)CC770_OBJ_MAX is not derived from a static array definition but as show below:
Okay...
enum {
CC770_OBJ_RX0 = 0, /* for receiving normal messages */
CC770_OBJ_RX1, /* for receiving normal messages */
CC770_OBJ_RX_RTR0, /* for receiving remote transmission requests */
CC770_OBJ_RX_RTR1, /* for receiving remote transmission requests */
CC770_OBJ_TX, /* for sending messages */
CC770_OBJ_MAX <================...then add a "," here :P 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 |