plat-ram.c (3e17404918b119813dfe8d7649df049a451c9e24) plat-ram.c (69f34c98c1416eb74c55e38a21dbf3e294966514)
1/* drivers/mtd/maps/plat-ram.c
2 *
3 * (c) 2004-2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/SWLINUX/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Generic platfrom device based RAM map
8 *
1/* drivers/mtd/maps/plat-ram.c
2 *
3 * (c) 2004-2005 Simtec Electronics
4 * http://www.simtec.co.uk/products/SWLINUX/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * Generic platfrom device based RAM map
8 *
9 * $Id: plat-ram.c,v 1.6 2005/11/07 00:52:24 gleixner Exp $
9 * $Id: plat-ram.c,v 1.7 2005/11/07 11:14:28 gleixner Exp $
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of

--- 68 unchanged lines hidden (view full) ---

86static int platram_remove(struct device *dev)
87{
88 struct platram_info *info = to_platram_info(dev);
89
90 dev_set_drvdata(dev, NULL);
91
92 dev_dbg(dev, "removing device\n");
93
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of

--- 68 unchanged lines hidden (view full) ---

86static int platram_remove(struct device *dev)
87{
88 struct platram_info *info = to_platram_info(dev);
89
90 dev_set_drvdata(dev, NULL);
91
92 dev_dbg(dev, "removing device\n");
93
94 if (info == NULL)
94 if (info == NULL)
95 return 0;
96
97 if (info->mtd) {
98#ifdef CONFIG_MTD_PARTITIONS
99 if (info->partitions) {
100 del_mtd_partitions(info->mtd);
101 kfree(info->partitions);
102 }

--- 10 unchanged lines hidden (view full) ---

113
114 if (info->area) {
115 release_resource(info->area);
116 kfree(info->area);
117 }
118
119 if (info->map.virt != NULL)
120 iounmap(info->map.virt);
95 return 0;
96
97 if (info->mtd) {
98#ifdef CONFIG_MTD_PARTITIONS
99 if (info->partitions) {
100 del_mtd_partitions(info->mtd);
101 kfree(info->partitions);
102 }

--- 10 unchanged lines hidden (view full) ---

113
114 if (info->area) {
115 release_resource(info->area);
116 kfree(info->area);
117 }
118
119 if (info->map.virt != NULL)
120 iounmap(info->map.virt);
121
121
122 kfree(info);
123
124 return 0;
125}
126
127/* platram_probe
128 *
129 * called from device drive system when a device matching our

--- 4 unchanged lines hidden (view full) ---

134{
135 struct platform_device *pd = to_platform_device(dev);
136 struct platdata_mtd_ram *pdata;
137 struct platram_info *info;
138 struct resource *res;
139 int err = 0;
140
141 dev_dbg(dev, "probe entered\n");
122 kfree(info);
123
124 return 0;
125}
126
127/* platram_probe
128 *
129 * called from device drive system when a device matching our

--- 4 unchanged lines hidden (view full) ---

134{
135 struct platform_device *pd = to_platform_device(dev);
136 struct platdata_mtd_ram *pdata;
137 struct platram_info *info;
138 struct resource *res;
139 int err = 0;
140
141 dev_dbg(dev, "probe entered\n");
142
142
143 if (dev->platform_data == NULL) {
144 dev_err(dev, "no platform data supplied\n");
145 err = -ENOENT;
146 goto exit_error;
147 }
148
149 pdata = dev->platform_data;
150

--- 84 unchanged lines hidden (view full) ---

235 }
236 }
237#endif /* CONFIG_MTD_PARTITIONS */
238
239 if (add_mtd_device(info->mtd)) {
240 dev_err(dev, "add_mtd_device() failed\n");
241 err = -ENOMEM;
242 }
143 if (dev->platform_data == NULL) {
144 dev_err(dev, "no platform data supplied\n");
145 err = -ENOENT;
146 goto exit_error;
147 }
148
149 pdata = dev->platform_data;
150

--- 84 unchanged lines hidden (view full) ---

235 }
236 }
237#endif /* CONFIG_MTD_PARTITIONS */
238
239 if (add_mtd_device(info->mtd)) {
240 dev_err(dev, "add_mtd_device() failed\n");
241 err = -ENOMEM;
242 }
243
243
244 dev_info(dev, "registered mtd device\n");
245 return err;
246
247 exit_free:
248 platram_remove(dev);
249 exit_error:
250 return err;
251}

--- 30 unchanged lines hidden ---
244 dev_info(dev, "registered mtd device\n");
245 return err;
246
247 exit_free:
248 platram_remove(dev);
249 exit_error:
250 return err;
251}

--- 30 unchanged lines hidden ---