*
* Return Value: returns negative number in the case of fail
*/
-int init_hw_struct(void)
-{
- int i=0;
- int irq_param_idx=0;
- int chan_param_idx=0;
-
- hardware_p->nr_boards=0;
- while ( (hw[i] != NULL) & (i < MAX_HW_CARDS) ) {
- hardware_p->nr_boards++;
-
- if (init_device_struct(i, &chan_param_idx, &irq_param_idx)) {
- CANMSG("Error initializing candevice_t structures.\n");
- return -ENODEV;
- }
- i++;
- }
-
- return 0;
-}
+// int init_hw_struct(void)
+// {
+// int i=0;
+// int irq_param_idx=0;
+// int chan_param_idx=0;
+//
+// hardware_p->nr_boards=0;
+// while ( (hw[i] != NULL) & (i < MAX_HW_CARDS) ) {
+// hardware_p->nr_boards++;
+//
+// if (init_device_struct(i, &chan_param_idx, &irq_param_idx)) {
+// CANMSG("Error initializing candevice_t structures.\n");
+// return -ENODEV;
+// }
+// i++;
+// }
+//
+// return 0;
+// }
/**
* init_device_struct - initializes single CAN device/board
*
* Return Value: returns negative number in the case of fail
*/
-int init_device_struct(int card, int *chan_param_idx_p, int *irq_param_idx_p)
-{
- struct candevice_t *candev;
- int ret;
- int irqnum;
- int chipnr;
- long bd;
- int irqsig=-1;
-
- candev=(struct candevice_t *)can_checked_malloc(sizeof(struct candevice_t));
- if (candev==NULL)
- return -ENOMEM;
-
- memset(candev, 0, sizeof(struct candevice_t));
-
- hardware_p->candevice[card]=candev;
- candev->candev_idx=card;
-
- candev=candev;
-
- candev->hwname=hw[card];
- candev->io_addr=io[card];
- candev->dev_base_addr=io[card];
-
- candev->hwspecops=(struct hwspecops_t *)can_checked_malloc(sizeof(struct hwspecops_t));
- if (candev->hwspecops==NULL)
- goto error_nomem;
-
- memset(candev->hwspecops, 0, sizeof(struct hwspecops_t));
-
- if (init_hwspecops(candev, &irqnum))
- goto error_nodev;
-
- if (candev->hwspecops->init_hw_data(candev))
- goto error_nodev;
-
- /* Alocate and initialize the chip structures */
- for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
-
- if(chipnr<irqnum)
- irqsig=irq[*irq_param_idx_p+chipnr];
-
- bd=baudrate[*chan_param_idx_p+chipnr];
- if(!bd) bd=baudrate[0];
-
- if ((ret=init_chip_struct(candev, chipnr, irqsig, bd*1000)))
- goto error_chip;
- }
-
-
-
- for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
- int m=minor[*chan_param_idx_p+chipnr];
- struct canchip_t *chip=candev->chip[chipnr];
- int objnr;
-
- register_chip_struct(chip, m);
-
- for (objnr=0; objnr<chip->max_objects; objnr++) {
- register_obj_struct(chip->msgobj[objnr], m);
- if(m>=0) m++;
- }
- }
-
- *irq_param_idx_p += irqnum;
- *chan_param_idx_p += candev->nr_all_chips;
-
- return 0;
-
- error_nodev:
- ret=-ENODEV;
- error_chip:
- candevice_done(candev);
- goto error_both;
-
- error_nomem:
- ret=-ENOMEM;
-
- error_both:
- hardware_p->candevice[card]=NULL;
- can_checked_free(candev);
- return ret;
-
-}
+// int init_device_struct(int card, int *chan_param_idx_p, int *irq_param_idx_p)
+// {
+// struct candevice_t *candev;
+// int ret;
+// int irqnum;
+// int chipnr;
+// long bd;
+// int irqsig=-1;
+//
+// candev=(struct candevice_t *)malloc(sizeof(struct candevice_t));
+// if (candev==NULL)
+// return -ENOMEM;
+//
+// memset(candev, 0, sizeof(struct candevice_t));
+//
+// hardware_p->candevice[card]=candev;
+// candev->candev_idx=card;
+//
+// candev=candev;
+//
+// candev->hwname=hw[card];
+// candev->io_addr=io[card];
+// candev->dev_base_addr=io[card];
+//
+// candev->hwspecops=(struct hwspecops_t *)malloc(sizeof(struct hwspecops_t));
+// if (candev->hwspecops==NULL)
+// goto error_nomem;
+//
+// memset(candev->hwspecops, 0, sizeof(struct hwspecops_t));
+//
+// if (init_hwspecops(candev, &irqnum))
+// goto error_nodev;
+//
+// if (candev->hwspecops->init_hw_data(candev))
+// goto error_nodev;
+//
+// /* Alocate and initialize the chip structures */
+// for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
+//
+// if(chipnr<irqnum)
+// irqsig=irq[*irq_param_idx_p+chipnr];
+//
+// bd=baudrate[*chan_param_idx_p+chipnr];
+// if(!bd) bd=baudrate[0];
+//
+// if ((ret=init_chip_struct(candev, chipnr, irqsig, bd*1000)))
+// goto error_chip;
+// }
+//
+//
+//
+// for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
+// int m=minor[*chan_param_idx_p+chipnr];
+// struct canchip_t *chip=candev->chip[chipnr];
+// int objnr;
+//
+// register_chip_struct(chip, m);
+//
+// for (objnr=0; objnr<chip->max_objects; objnr++) {
+// register_obj_struct(chip->msgobj[objnr], m);
+// if(m>=0) m++;
+// }
+// }
+//
+// *irq_param_idx_p += irqnum;
+// *chan_param_idx_p += candev->nr_all_chips;
+//
+// return 0;
+//
+// error_nodev:
+// ret=-ENODEV;
+// error_chip:
+// candevice_done(candev);
+// goto error_both;
+//
+// error_nomem:
+// ret=-ENOMEM;
+//
+// error_both:
+// hardware_p->candevice[card]=NULL;
+// free(candev);
+// return ret;
+//
+// }
/**
* init_chip_struct - initializes one CAN chip structure
int objnr;
int ret;
- candev->chip[chipnr]=(struct canchip_t *)can_checked_malloc(sizeof(struct canchip_t));
+ candev->chip[chipnr]=(struct canchip_t *)malloc(sizeof(struct canchip_t));
if ((chip=candev->chip[chipnr])==NULL)
return -ENOMEM;
chip->write_register=candev->hwspecops->write_register;
chip->read_register=candev->hwspecops->read_register;
- chip->chipspecops=can_checked_malloc(sizeof(struct chipspecops_t));
+ chip->chipspecops=malloc(sizeof(struct chipspecops_t));
if (chip->chipspecops==NULL)
return -ENOMEM;
memset(chip->chipspecops,0,sizeof(struct chipspecops_t));
struct msgobj_t *obj;
int ret;
- obj=(struct msgobj_t *)can_checked_malloc(sizeof(struct msgobj_t));
+ obj=(struct msgobj_t *)malloc(sizeof(struct msgobj_t));
hostchip->msgobj[objnr]=obj;
if (obj == NULL)
return -ENOMEM;
atomic_set(&obj->obj_used,0);
INIT_LIST_HEAD(&obj->obj_users);
- init_timer(&obj->tx_timeout);
+// init_timer(&obj->tx_timeout);
- qends = (struct canque_ends_t *)can_checked_malloc(sizeof(struct canque_ends_t));
+ qends = (struct canque_ends_t *)malloc(sizeof(struct canque_ends_t));
if(qends == NULL) return -ENOMEM;
memset(qends, 0, sizeof(struct canque_ends_t));
obj->hostchip=hostchip;
*
* Return Value: returns negative number in the case of fail
*/
-int init_hwspecops(struct candevice_t *candev, int *irqnum_p)
-{
- const struct boardtype_t *brp;
-
- brp = boardtype_find(candev->hwname);
-
- if(!brp) {
- CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",candev->hwname);
- return -EINVAL;
- }
-
- if(irqnum_p)
- *irqnum_p=brp->irqnum;
- brp->board_register(candev->hwspecops);
-
- return 0;
-}
+// int init_hwspecops(struct candevice_t *candev, int *irqnum_p)
+// {
+// const struct boardtype_t *brp;
+//
+// brp = boardtype_find(candev->hwname);
+//
+// if(!brp) {
+// CANMSG("Sorry, hardware \"%s\" is currently not supported.\n",candev->hwname);
+// return -EINVAL;
+// }
+//
+// if(irqnum_p)
+// *irqnum_p=brp->irqnum;
+// brp->board_register(candev->hwspecops);
+//
+// return 0;
+// }