[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1360270997-7639-6-git-send-email-tomas.winkler@intel.com>
Date: Thu, 7 Feb 2013 23:03:11 +0200
From: Tomas Winkler <tomas.winkler@...el.com>
To: gregkh@...uxfoundation.org, sameo@...ux.intel.com
Cc: arnd@...db.de, linux-kernel@...r.kernel.org,
Tomas Winkler <tomas.winkler@...el.com>
Subject: [char-misc-next 05/11] mei: bus: Call bus routines from the core code
From: Samuel Ortiz <sameo@...ux.intel.com>
Register the MEI bus type against the kernel core bus APIs and
call the bus Rx handler from interrupt.c
Signed-off-by: Samuel Ortiz <sameo@...ux.intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@...el.com>
---
drivers/misc/mei/bus.c | 22 ++++++++++++++++++++++
drivers/misc/mei/interrupt.c | 2 ++
drivers/misc/mei/mei_dev.h | 4 ++++
drivers/misc/mei/pci-me.c | 6 ++++++
4 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 97afec6..e2e15d1 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -429,3 +429,25 @@ int mei_bus_register_event_cb(struct mei_bus_client *client,
return 0;
}
EXPORT_SYMBOL(mei_bus_register_event_cb);
+
+void mei_bus_rx_event(struct mei_cl *cl)
+{
+ struct mei_bus_client *client = cl->client;
+
+ if (!client || !client->event_cb)
+ return;
+
+ set_bit(MEI_BUS_EVENT_RX, &client->events);
+
+ schedule_work(&client->event_work);
+}
+
+int mei_bus_init(struct pci_dev *pdev)
+{
+ return bus_register(&mei_bus_type);
+}
+
+void mei_bus_exit(void)
+{
+ bus_unregister(&mei_bus_type);
+}
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c
index 3535b26..d0dea50 100644
--- a/drivers/misc/mei/interrupt.c
+++ b/drivers/misc/mei/interrupt.c
@@ -49,6 +49,8 @@ void mei_irq_complete_handler(struct mei_cl *cl, struct mei_cl_cb *cb_pos)
cl->reading_state = MEI_READ_COMPLETE;
if (waitqueue_active(&cl->rx_wait))
wake_up_interruptible(&cl->rx_wait);
+ else
+ mei_bus_rx_event(cl);
}
}
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index d9adad6..cb1bac0 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -420,6 +420,10 @@ static inline unsigned long mei_secs_to_jiffies(unsigned long sec)
return msecs_to_jiffies(sec * MSEC_PER_SEC);
}
+void mei_bus_rx_event(struct mei_cl *cl);
+int mei_bus_init(struct pci_dev *pdev);
+void mei_bus_exit(void);
+
/*
* mei init function prototypes
diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
index b40ec06..f736531 100644
--- a/drivers/misc/mei/pci-me.c
+++ b/drivers/misc/mei/pci-me.c
@@ -197,6 +197,9 @@ static int mei_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
mei_pdev = pdev;
pci_set_drvdata(pdev, dev);
+ err = mei_bus_init(mei_pdev);
+ if (err)
+ goto deregister_mei;
schedule_delayed_work(&dev->timer_work, HZ);
@@ -206,6 +209,8 @@ static int mei_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return 0;
+deregister_mei:
+ mei_deregister();
release_irq:
mei_disable_interrupts(dev);
flush_scheduled_work();
@@ -300,6 +305,7 @@ static void mei_remove(struct pci_dev *pdev)
pci_release_regions(pdev);
pci_disable_device(pdev);
+ mei_bus_exit();
mei_deregister();
}
--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists