usbatm cxacru.c,1.8,1.9
kagan at infradead.org
kagan at infradead.org
Tue Feb 8 07:42:30 EST 2005
Update of /home/cvs/usbatm
In directory phoenix.infradead.org:/tmp/cvs-serv20972
Modified Files:
cxacru.c
Log Message:
Make configuration file optional (apparently most firmware has a decent set of
defaults built in).
Index: cxacru.c
===================================================================
RCS file: /home/cvs/usbatm/cxacru.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- cxacru.c 1 Feb 2005 23:20:49 -0000 1.8
+++ cxacru.c 8 Feb 2005 12:42:27 -0000 1.9
@@ -595,21 +595,22 @@
}
/* Load config data (le32), doing one packet at a time */
- for (off = 0; off < cf->size / 4; ) {
- u32 buf[CMD_PACKET_SIZE / 4 - 1];
- int i, len = min_t(int, cf->size / 4 - off, CMD_PACKET_SIZE / 4 / 2 - 1);
- buf[0] = cpu_to_le32(len);
- for (i = 0; i < len; i++, off++) {
- buf[i * 2 + 1] = cpu_to_le32(off);
- memcpy(buf + i * 2 + 2, cf->data + off * 4, 4);
+ if (cf)
+ for (off = 0; off < cf->size / 4; ) {
+ u32 buf[CMD_PACKET_SIZE / 4 - 1];
+ int i, len = min_t(int, cf->size / 4 - off, CMD_PACKET_SIZE / 4 / 2 - 1);
+ buf[0] = cpu_to_le32(len);
+ for (i = 0; i < len; i++, off++) {
+ buf[i * 2 + 1] = cpu_to_le32(off);
+ memcpy(buf + i * 2 + 2, cf->data + off * 4, 4);
+ }
+ ret = cxacru_cm(instance, CM_REQUEST_CARD_DATA_SET,
+ (u8 *) buf, len, NULL, 0);
+ if (ret < 0) {
+ err("load config data failed: %d", ret);
+ return;
+ }
}
- ret = cxacru_cm(instance, CM_REQUEST_CARD_DATA_SET,
- (u8 *) buf, len, NULL, 0);
- if (ret < 0) {
- err("load config data failed: %d", ret);
- return;
- }
- }
msleep_interruptible(4000);
}
@@ -624,7 +625,7 @@
dbg("cxacru_find_firmware: looking for %s", buf);
if (request_firmware(fw_p, buf, dev)) {
- dev_warn(dev, "no stage %s firmware found\n", phase);
+ dev_dbg(dev, "no stage %s firmware found\n", phase);
return -ENOENT;
}
@@ -636,30 +637,36 @@
static int cxacru_heavy_init(struct usbatm_data *usbatm_instance,
struct usb_interface *usb_intf)
{
+ struct device *dev = &instance->usbatm->usb_dev->dev;
const struct firmware *fw, *bp, *cf;
struct cxacru_data *instance = usbatm_instance->driver_data;
- int ret = -ENOENT;
- if (!cxacru_find_firmware(instance, "fw", &fw)) {
- if (!cxacru_find_firmware(instance, "cf", &cf)) {
- if (cxacru_find_firmware(instance, "bp", &bp))
- /* ok, assume it's not needed */
- bp = NULL;
- cxacru_upload_firmware(instance, fw, bp, cf);
-
- ret = cxacru_card_status(instance);
- if (ret)
- dbg("modem initialisation failed");
- else
- dbg("done setting up the modem");
-
- if (bp)
- release_firmware(bp);
- release_firmware(cf);
- }
- release_firmware(fw);
+ int ret = cxacru_find_firmware(instance, "fw", &fw);
+ if (ret) {
+ dev_warn(dev, "firmware unavailable (hotplug configuration problem?)\n");
+ return ret;
}
+ if (cxacru_find_firmware(instance, "cf", &cf)) /* optional */
+ cf = NULL;
+
+ if (cxacru_find_firmware(instance, "bp", &bp)) /* optional */
+ bp = NULL;
+
+ cxacru_upload_firmware(instance, fw, bp, cf);
+
+ if (bp)
+ release_firmware(bp);
+ if (cf)
+ release_firmware(cf);
+ release_firmware(fw);
+
+ ret = cxacru_card_status(instance);
+ if (ret)
+ dbg("modem initialisation failed");
+ else
+ dbg("done setting up the modem");
+
return ret;
}
#endif /* USE_FW_LOADER */
More information about the Usbatm-commits
mailing list