Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
[linux-3.10.git] / drivers / staging / nvec / nvec.c
index 695ea35..094fdc3 100644 (file)
@@ -264,7 +264,7 @@ int nvec_write_async(struct nvec_chip *nvec, const unsigned char *data,
        list_add_tail(&msg->node, &nvec->tx_data);
        spin_unlock_irqrestore(&nvec->tx_lock, flags);
 
-       queue_work(nvec->wq, &nvec->tx_work);
+       schedule_work(&nvec->tx_work);
 
        return 0;
 }
@@ -294,8 +294,10 @@ struct nvec_msg *nvec_write_sync(struct nvec_chip *nvec,
 
        nvec->sync_write_pending = (data[1] << 8) + data[0];
 
-       if (nvec_write_async(nvec, data, size) < 0)
+       if (nvec_write_async(nvec, data, size) < 0) {
+               mutex_unlock(&nvec->sync_write_mutex);
                return NULL;
+       }
 
        dev_dbg(nvec->dev, "nvec_sync_write: 0x%04x\n",
                                        nvec->sync_write_pending);
@@ -366,8 +368,7 @@ static void nvec_request_master(struct work_struct *work)
 static int parse_msg(struct nvec_chip *nvec, struct nvec_msg *msg)
 {
        if ((msg->data[0] & 1 << 7) == 0 && msg->data[3]) {
-               dev_err(nvec->dev, "ec responded %02x %02x %02x %02x\n",
-                       msg->data[0], msg->data[1], msg->data[2], msg->data[3]);
+               dev_err(nvec->dev, "ec responded %*ph\n", 4, msg->data);
                return -EINVAL;
        }
 
@@ -470,7 +471,7 @@ static void nvec_rx_completed(struct nvec_chip *nvec)
        if (!nvec_msg_is_event(nvec->rx))
                complete(&nvec->ec_transfer);
 
-       queue_work(nvec->wq, &nvec->rx_work);
+       schedule_work(&nvec->rx_work);
 }
 
 /**
@@ -737,12 +738,14 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev)
                nvec->gpio = pdata->gpio;
                nvec->i2c_addr = pdata->i2c_addr;
        } else if (nvec->dev->of_node) {
-               nvec->gpio = of_get_named_gpio(nvec->dev->of_node, "request-gpios", 0);
+               nvec->gpio = of_get_named_gpio(nvec->dev->of_node,
+                                       "request-gpios", 0);
                if (nvec->gpio < 0) {
                        dev_err(&pdev->dev, "no gpio specified");
                        return -ENODEV;
                }
-               if (of_property_read_u32(nvec->dev->of_node, "slave-addr", &nvec->i2c_addr)) {
+               if (of_property_read_u32(nvec->dev->of_node,
+                                       "slave-addr", &nvec->i2c_addr)) {
                        dev_err(&pdev->dev, "no i2c address specified");
                        return -ENODEV;
                }
@@ -769,7 +772,7 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       i2c_clk = clk_get_sys("tegra-i2c.2", NULL);
+       i2c_clk = clk_get_sys("tegra-i2c.2", "div-clk");
        if (IS_ERR(i2c_clk)) {
                dev_err(nvec->dev, "failed to get controller clock\n");
                return -ENODEV;
@@ -791,13 +794,11 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev)
        INIT_LIST_HEAD(&nvec->tx_data);
        INIT_WORK(&nvec->rx_work, nvec_dispatch);
        INIT_WORK(&nvec->tx_work, nvec_request_master);
-       nvec->wq = alloc_workqueue("nvec", WQ_NON_REENTRANT, 2);
 
        err = devm_gpio_request_one(&pdev->dev, nvec->gpio, GPIOF_OUT_INIT_HIGH,
                                        "nvec gpio");
        if (err < 0) {
                dev_err(nvec->dev, "couldn't request gpio\n");
-               destroy_workqueue(nvec->wq);
                return -ENODEV;
        }
 
@@ -805,7 +806,6 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev)
                                "nvec", nvec);
        if (err) {
                dev_err(nvec->dev, "couldn't request irq\n");
-               destroy_workqueue(nvec->wq);
                return -ENODEV;
        }
        disable_irq(nvec->irq);
@@ -837,7 +837,7 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev)
        }
 
        ret = mfd_add_devices(nvec->dev, -1, nvec_devices,
-                             ARRAY_SIZE(nvec_devices), base, 0);
+                             ARRAY_SIZE(nvec_devices), base, 0, NULL);
        if (ret)
                dev_err(nvec->dev, "error adding subdevices\n");
 
@@ -859,7 +859,8 @@ static int __devexit tegra_nvec_remove(struct platform_device *pdev)
 
        nvec_write_async(nvec, EC_DISABLE_EVENT_REPORTING, 3);
        mfd_remove_devices(nvec->dev);
-       destroy_workqueue(nvec->wq);
+       cancel_work_sync(&nvec->rx_work);
+       cancel_work_sync(&nvec->tx_work);
 
        return 0;
 }