Commit d992ac71 authored by Jean Tourrilhes's avatar Jean Tourrilhes Committed by Linus Torvalds

[IRDA]: Update dongle api.

From Martin Diehl.

* change dongle api such that raw r/w and modem line helpers are directly
  called, not virtual callbacks.
parent 672ab41e
......@@ -121,15 +121,17 @@ extern int sirdev_set_dongle(struct sir_dev *dev, IRDA_DONGLE type);
extern void sirdev_write_complete(struct sir_dev *dev);
extern int sirdev_receive(struct sir_dev *dev, const unsigned char *cp, size_t count);
/* low level helpers for SIR device/dongle setup */
extern int sirdev_raw_write(struct sir_dev *dev, const char *buf, int len);
extern int sirdev_raw_read(struct sir_dev *dev, char *buf, int len);
extern int sirdev_set_dtr_rts(struct sir_dev *dev, int dtr, int rts);
/* not exported */
extern int sirdev_get_dongle(struct sir_dev *self, IRDA_DONGLE type);
extern int sirdev_put_dongle(struct sir_dev *self);
extern int sirdev_raw_write(struct sir_dev *dev, const char *buf, int len);
extern int sirdev_raw_read(struct sir_dev *dev, char *buf, int len);
extern void sirdev_enable_rx(struct sir_dev *dev);
extern int sirdev_schedule_request(struct sir_dev *dev, int state, unsigned param);
extern int __init irda_thread_create(void);
extern void __exit irda_thread_join(void);
......@@ -195,10 +197,6 @@ struct sir_dev {
const struct sir_driver * drv;
void *priv;
/* dongle callbacks to the SIR device */
int (*read)(struct sir_dev *, char *buf, int len);
int (*write)(struct sir_dev *, const char *buf, int len);
int (*set_dtr_rts)(struct sir_dev *, int dtr, int rts);
};
#endif /* IRDA_SIR_H */
......@@ -37,6 +37,10 @@ EXPORT_SYMBOL(sirdev_set_dongle);
EXPORT_SYMBOL(sirdev_write_complete);
EXPORT_SYMBOL(sirdev_receive);
EXPORT_SYMBOL(sirdev_raw_write);
EXPORT_SYMBOL(sirdev_raw_read);
EXPORT_SYMBOL(sirdev_set_dtr_rts);
static int __init sir_core_init(void)
{
return irda_thread_create();
......
......@@ -117,6 +117,14 @@ int sirdev_raw_read(struct sir_dev *dev, char *buf, int len)
return count;
}
int sirdev_set_dtr_rts(struct sir_dev *dev, int dtr, int rts)
{
int ret = -ENXIO;
if (dev->drv->set_dtr_rts != 0)
ret = dev->drv->set_dtr_rts(dev, dtr, rts);
return ret;
}
/**********************************************************************/
/* called from client driver - likely with bh-context - to indicate
......
......@@ -102,12 +102,6 @@ int sirdev_get_dongle(struct sir_dev *dev, IRDA_DONGLE type)
err = -ESTALE;
goto out_unlock; /* rmmod already pending */
}
/* Initialize dongle driver callbacks */
dev->read = sirdev_raw_read;
dev->write = sirdev_raw_write;
dev->set_dtr_rts = dev->drv->set_dtr_rts;
dev->dongle_drv = drv;
if (!drv->open || (err=drv->open(dev))!=0)
......
......@@ -311,15 +311,9 @@ static void irda_config_fsm(void *data)
break;
case SIRDEV_STATE_SET_DTR_RTS:
if (dev->drv->set_dtr_rts) {
int dtr, rts;
dtr = (fsm->param&0x02) ? TRUE : FALSE;
rts = (fsm->param&0x01) ? TRUE : FALSE;
ret = dev->drv->set_dtr_rts(dev,dtr,rts);
}
else
ret = -EINVAL;
ret = sirdev_set_dtr_rts(dev,
(fsm->param&0x02) ? TRUE : FALSE,
(fsm->param&0x01) ? TRUE : FALSE);
next_state = SIRDEV_STATE_DONE;
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment