Re: [PATCH 2/4] mfd: motmdm: Add Motorola TS 27.010 serdev modem driver for droid4
From: Tony Lindgren
Date: Thu Feb 20 2020 - 14:52:06 EST
* Tony Lindgren <tony@xxxxxxxxxxx> [700101 00:00]:
> +static int motmdm_register_dlci(struct device *dev,
> + struct motmdm_dlci *mot_dlci)
> +{
> + struct motmdm *ddata;
> + struct gsm_serdev *gsd;
> + struct gsm_serdev_dlci *gsm_dlci;
> + int err;
> +
> + if (!dev || !mot_dlci || !mot_dlci->line)
> + return -EINVAL;
> +
> + err = pm_runtime_get_sync(dev);
> + if ((err != -EINPROGRESS) && err < 0) {
> + pm_runtime_put_noidle(dev);
> +
> + return err;
> + }
> +
> + ddata = gsm_serdev_get_drvdata(dev);
> + gsd = &ddata->gsd;
> + gsm_dlci = &mot_dlci->gsm_dlci;
> + INIT_LIST_HEAD(&mot_dlci->list);
> + init_waitqueue_head(&mot_dlci->read_queue);
> + gsm_dlci->line = mot_dlci->line;
> + gsm_dlci->receive_buf = motmdm_dlci_receive_buf;
> +
> + err = gsm_serdev_register_dlci(gsd, gsm_dlci);
> + if (err) {
> + dev_warn(dev, "error registering dlci%i: %i\n",
> + mot_dlci->line, err);
> + kfifo_free(&mot_dlci->read_fifo);
> + memset(gsm_dlci, 0, sizeof(*gsm_dlci));
> + } else {
> + mot_dlci->privdata = ddata;
> + }
Here we want mot_dlci->privdata initialized before
gsm_serdev_register_dlci, otherwise we may get an interrupt
between gsm_serdev_register_dlci and setting mot_dlci->privdata.
So I'll be sending out v4 series.
Regards,
Tony