can: m_can: let m_can_class_allocate_dev() allocate driver specific private data

This patch enhances m_can_class_allocate_dev() to allocate driver specific
private data. The driver's private data struct must contain struct
m_can_classdev as its first member followed by the remaining private data.

Link: https://lore.kernel.org/r/20201212175518.139651-7-mkl@pengutronix.de
Reviewed-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Dan Murphy <dmurphy@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
Marc Kleine-Budde
2020-12-12 18:55:17 +01:00
parent b8d6255548
commit ac33ffd3e2
5 changed files with 56 additions and 50 deletions

View File

@@ -86,8 +86,6 @@ struct m_can_classdev {
struct m_can_ops *ops;
void *device_data;
int version;
u32 irqstatus;
@@ -97,7 +95,7 @@ struct m_can_classdev {
struct mram_cfg mcfg[MRAM_CFG_NUM];
};
struct m_can_classdev *m_can_class_allocate_dev(struct device *dev);
struct m_can_classdev *m_can_class_allocate_dev(struct device *dev, int sizeof_priv);
void m_can_class_free_dev(struct net_device *net);
int m_can_class_register(struct m_can_classdev *cdev);
void m_can_class_unregister(struct m_can_classdev *cdev);