Re: [PATCH 3/3] cxacru: Store all device status information and report it when atm_proc_read is called.

From: Duncan Sands
Date: Wed Jan 31 2007 - 09:20:34 EST


Hi Simon,

> +static int cxacru_proc_read(struct usbatm_data *usbatm_instance,
> + struct atm_dev *atm_dev, loff_t * pos, char *page)
> +{
> + struct cxacru_data *instance = usbatm_instance->driver_data;
> + u32 *cxinf = instance->cxinf_status;
> + int left = *pos;

if there was no successfull call to cxacru_poll_status before this,
then you will output junk. Please initialize cxinf_status to something
sensible in cxacru_bind.

> + if (!left--)
> + return sprintf(page, "MAC=%02x:%02x:%02x:%02x:%02x:%02x\n",
> + atm_dev->esi[0], atm_dev->esi[1],
> + atm_dev->esi[2], atm_dev->esi[3],
> + atm_dev->esi[4], atm_dev->esi[5]);

Rather than duplicating code in usbatm, I think it would be better to
split the various output bits in usbatm_atm_proc_read into their own
functions, and export them, so they can be called from both
usbatm_atm_proc_read and cxacru_proc_read.

Best wishes,

Duncan.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/