Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'gpmc-omap-for-v4.8' of https://github.com/rogerq/linux into next/drivers

OMAP-GPMC: driver updates for v4.8

* Make GPMC driver non modular as it is going to
be built-in only till arch/arm/mach-omap2 users
are removed.

* Fix build if CONFIG_OF is not defined.

* tag 'gpmc-omap-for-v4.8' of https://github.com/rogerq/linux:
memory: omap-gpmc: Move gpio functions out of #ifdef CONFIG_OF
memory: omap-gpmc: make it explicitly non-modular

Signed-off-by: Olof Johansson <olof@lixom.net>

+63 -73
+63 -73
drivers/memory/omap-gpmc.c
··· 20 20 #include <linux/ioport.h> 21 21 #include <linux/spinlock.h> 22 22 #include <linux/io.h> 23 - #include <linux/module.h> 24 23 #include <linux/gpio/driver.h> 25 24 #include <linux/interrupt.h> 26 25 #include <linux/irqdomain.h> ··· 1806 1807 { .compatible = "ti,am3352-gpmc" }, /* am335x devices */ 1807 1808 { } 1808 1809 }; 1809 - MODULE_DEVICE_TABLE(of, gpmc_dt_ids); 1810 1810 1811 1811 /** 1812 1812 * gpmc_read_settings_dt - read gpmc settings from device-tree ··· 2153 2155 return ret; 2154 2156 } 2155 2157 2156 - static int gpmc_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) 2157 - { 2158 - return 1; /* we're input only */ 2159 - } 2160 - 2161 - static int gpmc_gpio_direction_input(struct gpio_chip *chip, 2162 - unsigned int offset) 2163 - { 2164 - return 0; /* we're input only */ 2165 - } 2166 - 2167 - static int gpmc_gpio_direction_output(struct gpio_chip *chip, 2168 - unsigned int offset, int value) 2169 - { 2170 - return -EINVAL; /* we're input only */ 2171 - } 2172 - 2173 - static void gpmc_gpio_set(struct gpio_chip *chip, unsigned int offset, 2174 - int value) 2175 - { 2176 - } 2177 - 2178 - static int gpmc_gpio_get(struct gpio_chip *chip, unsigned int offset) 2179 - { 2180 - u32 reg; 2181 - 2182 - offset += 8; 2183 - 2184 - reg = gpmc_read_reg(GPMC_STATUS) & BIT(offset); 2185 - 2186 - return !!reg; 2187 - } 2188 - 2189 - static int gpmc_gpio_init(struct gpmc_device *gpmc) 2190 - { 2191 - int ret; 2192 - 2193 - gpmc->gpio_chip.parent = gpmc->dev; 2194 - gpmc->gpio_chip.owner = THIS_MODULE; 2195 - gpmc->gpio_chip.label = DEVICE_NAME; 2196 - gpmc->gpio_chip.ngpio = gpmc_nr_waitpins; 2197 - gpmc->gpio_chip.get_direction = gpmc_gpio_get_direction; 2198 - gpmc->gpio_chip.direction_input = gpmc_gpio_direction_input; 2199 - gpmc->gpio_chip.direction_output = gpmc_gpio_direction_output; 2200 - gpmc->gpio_chip.set = gpmc_gpio_set; 2201 - gpmc->gpio_chip.get = gpmc_gpio_get; 2202 - gpmc->gpio_chip.base = -1; 2203 - 2204 - ret = gpiochip_add(&gpmc->gpio_chip); 2205 - if (ret < 0) { 2206 - dev_err(gpmc->dev, "could not register gpio chip: %d\n", ret); 2207 - return ret; 2208 - } 2209 - 2210 - return 0; 2211 - } 2212 - 2213 - static void gpmc_gpio_exit(struct gpmc_device *gpmc) 2214 - { 2215 - gpiochip_remove(&gpmc->gpio_chip); 2216 - } 2217 - 2218 2158 static int gpmc_probe_dt(struct platform_device *pdev) 2219 2159 { 2220 2160 int ret; ··· 2217 2281 { 2218 2282 return 0; 2219 2283 } 2220 - #endif 2284 + #endif /* CONFIG_OF */ 2285 + 2286 + static int gpmc_gpio_get_direction(struct gpio_chip *chip, unsigned int offset) 2287 + { 2288 + return 1; /* we're input only */ 2289 + } 2290 + 2291 + static int gpmc_gpio_direction_input(struct gpio_chip *chip, 2292 + unsigned int offset) 2293 + { 2294 + return 0; /* we're input only */ 2295 + } 2296 + 2297 + static int gpmc_gpio_direction_output(struct gpio_chip *chip, 2298 + unsigned int offset, int value) 2299 + { 2300 + return -EINVAL; /* we're input only */ 2301 + } 2302 + 2303 + static void gpmc_gpio_set(struct gpio_chip *chip, unsigned int offset, 2304 + int value) 2305 + { 2306 + } 2307 + 2308 + static int gpmc_gpio_get(struct gpio_chip *chip, unsigned int offset) 2309 + { 2310 + u32 reg; 2311 + 2312 + offset += 8; 2313 + 2314 + reg = gpmc_read_reg(GPMC_STATUS) & BIT(offset); 2315 + 2316 + return !!reg; 2317 + } 2318 + 2319 + static int gpmc_gpio_init(struct gpmc_device *gpmc) 2320 + { 2321 + int ret; 2322 + 2323 + gpmc->gpio_chip.parent = gpmc->dev; 2324 + gpmc->gpio_chip.owner = THIS_MODULE; 2325 + gpmc->gpio_chip.label = DEVICE_NAME; 2326 + gpmc->gpio_chip.ngpio = gpmc_nr_waitpins; 2327 + gpmc->gpio_chip.get_direction = gpmc_gpio_get_direction; 2328 + gpmc->gpio_chip.direction_input = gpmc_gpio_direction_input; 2329 + gpmc->gpio_chip.direction_output = gpmc_gpio_direction_output; 2330 + gpmc->gpio_chip.set = gpmc_gpio_set; 2331 + gpmc->gpio_chip.get = gpmc_gpio_get; 2332 + gpmc->gpio_chip.base = -1; 2333 + 2334 + ret = gpiochip_add(&gpmc->gpio_chip); 2335 + if (ret < 0) { 2336 + dev_err(gpmc->dev, "could not register gpio chip: %d\n", ret); 2337 + return ret; 2338 + } 2339 + 2340 + return 0; 2341 + } 2342 + 2343 + static void gpmc_gpio_exit(struct gpmc_device *gpmc) 2344 + { 2345 + gpiochip_remove(&gpmc->gpio_chip); 2346 + } 2221 2347 2222 2348 static int gpmc_probe(struct platform_device *pdev) 2223 2349 { ··· 2435 2437 { 2436 2438 return platform_driver_register(&gpmc_driver); 2437 2439 } 2438 - 2439 - static __exit void gpmc_exit(void) 2440 - { 2441 - platform_driver_unregister(&gpmc_driver); 2442 - 2443 - } 2444 - 2445 2440 postcore_initcall(gpmc_init); 2446 - module_exit(gpmc_exit); 2447 2441 2448 2442 static struct omap3_gpmc_regs gpmc_context; 2449 2443