浏览代码

mfd: Add platform data pointer back

Now that we have a way to pass MFD cells down to the sub drivers,
we can gradually get rid of mfd_data by putting the platform pointer
back in place.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Samuel Ortiz 14 年之前
父节点
当前提交
eb8956074e
共有 2 个文件被更改,包括 11 次插入0 次删除
  1. 7 0
      drivers/mfd/mfd-core.c
  2. 4 0
      include/linux/mfd/core.h

+ 7 - 0
drivers/mfd/mfd-core.c

@@ -88,6 +88,13 @@ static int mfd_add_device(struct device *parent, int id,
 
 
 	pdev->dev.parent = parent;
 	pdev->dev.parent = parent;
 
 
+	if (cell->pdata_size) {
+		ret = platform_device_add_data(pdev,
+					cell->platform_data, cell->pdata_size);
+		if (ret)
+			goto fail_res;
+	}
+
 	ret = mfd_platform_add_cell(pdev, cell);
 	ret = mfd_platform_add_cell(pdev, cell);
 	if (ret)
 	if (ret)
 		goto fail_res;
 		goto fail_res;

+ 4 - 0
include/linux/mfd/core.h

@@ -36,6 +36,10 @@ struct mfd_cell {
 	/* mfd_data can be used to pass data to client drivers */
 	/* mfd_data can be used to pass data to client drivers */
 	void			*mfd_data;
 	void			*mfd_data;
 
 
+	/* platform data passed to the sub devices drivers */
+	void			*platform_data;
+	size_t			pdata_size;
+
 	/*
 	/*
 	 * These resources can be specified relative to the parent device.
 	 * These resources can be specified relative to the parent device.
 	 * For accessing hardware you should use resources from the platform dev
 	 * For accessing hardware you should use resources from the platform dev