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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pcmcia-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux

Pull PCMCIA fixes and cleanups from Dominik Brodowski:
"A number of minor PCMCIA bugfixes and cleanups, including the removal
of unused code paths"

[ Dominik suggested this might be 6.18 material, but having looked
through this, it looks appropriate early: minor trivial fixes and then
one slightly bigger patch that removes dead code - Linus ]

* tag 'pcmcia-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux:
pcmcia: Add error handling for add_interval() in do_validate_mem()
pcmcia: cs: Remove unused pcmcia_get_socket_by_nr
pcmcia: omap: Add missing check for platform_get_resource
pcmcia: Use str_off_on() and str_yes_no() helpers
pcmcia: remove PCCARD_IODYN
pcmcia: ds: Emphasize "really" epizeuxis
pcmcia: Fix a NULL pointer dereference in __iodyn_find_io_region()
pcmcia: omap_cf: Mark driver struct with __refdata to prevent section mismatch

+17 -202
-3
drivers/pcmcia/Kconfig
··· 250 250 config PCCARD_NONSTATIC 251 251 bool 252 252 253 - config PCCARD_IODYN 254 - bool 255 - 256 253 endif # PCCARD
-1
drivers/pcmcia/Makefile
··· 12 12 13 13 pcmcia_rsrc-y += rsrc_mgr.o 14 14 pcmcia_rsrc-$(CONFIG_PCCARD_NONSTATIC) += rsrc_nonstatic.o 15 - pcmcia_rsrc-$(CONFIG_PCCARD_IODYN) += rsrc_iodyn.o 16 15 obj-$(CONFIG_PCCARD) += pcmcia_rsrc.o 17 16 18 17
-17
drivers/pcmcia/cs.c
··· 229 229 EXPORT_SYMBOL(pcmcia_unregister_socket); 230 230 231 231 232 - struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr) 233 - { 234 - struct pcmcia_socket *s; 235 - 236 - down_read(&pcmcia_socket_list_rwsem); 237 - list_for_each_entry(s, &pcmcia_socket_list, socket_list) 238 - if (s->sock == nr) { 239 - up_read(&pcmcia_socket_list_rwsem); 240 - return s; 241 - } 242 - up_read(&pcmcia_socket_list_rwsem); 243 - 244 - return NULL; 245 - 246 - } 247 - EXPORT_SYMBOL(pcmcia_get_socket_by_nr); 248 - 249 232 static int socket_reset(struct pcmcia_socket *skt) 250 233 { 251 234 int status, i;
-1
drivers/pcmcia/cs_internal.h
··· 116 116 extern const struct class pcmcia_socket_class; 117 117 118 118 int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); 119 - struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); 120 119 121 120 void pcmcia_parse_uevents(struct pcmcia_socket *socket, unsigned int events); 122 121 #define PCMCIA_UEVENT_EJECT 0x0001
+1 -1
drivers/pcmcia/ds.c
··· 1308 1308 * physically present, even if the call to this function returns 1309 1309 * non-NULL. Furthermore, the device driver most likely is unbound 1310 1310 * almost immediately, so the timeframe where pcmcia_dev_present 1311 - * returns NULL is probably really really small. 1311 + * returns NULL is probably really, really small. 1312 1312 */ 1313 1313 struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *_p_dev) 1314 1314 {
+9 -1
drivers/pcmcia/omap_cf.c
··· 215 215 return -EINVAL; 216 216 217 217 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 218 + if (!res) 219 + return -EINVAL; 218 220 219 221 cf = kzalloc(sizeof *cf, GFP_KERNEL); 220 222 if (!cf) ··· 304 302 kfree(cf); 305 303 } 306 304 307 - static struct platform_driver omap_cf_driver = { 305 + /* 306 + * omap_cf_remove() lives in .exit.text. For drivers registered via 307 + * platform_driver_probe() this is ok because they cannot get unbound at 308 + * runtime. So mark the driver struct with __refdata to prevent modpost 309 + * triggering a section mismatch warning. 310 + */ 311 + static struct platform_driver omap_cf_driver __refdata = { 308 312 .driver = { 309 313 .name = driver_name, 310 314 },
-168
drivers/pcmcia/rsrc_iodyn.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * rsrc_iodyn.c -- Resource management routines for MEM-static sockets. 4 - * 5 - * The initial developer of the original code is David A. Hinds 6 - * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds 7 - * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. 8 - * 9 - * (C) 1999 David A. Hinds 10 - */ 11 - 12 - #include <linux/slab.h> 13 - #include <linux/module.h> 14 - #include <linux/kernel.h> 15 - 16 - #include <pcmcia/ss.h> 17 - #include <pcmcia/cistpl.h> 18 - #include "cs_internal.h" 19 - 20 - 21 - struct pcmcia_align_data { 22 - unsigned long mask; 23 - unsigned long offset; 24 - }; 25 - 26 - static resource_size_t pcmcia_align(void *align_data, 27 - const struct resource *res, 28 - resource_size_t size, resource_size_t align) 29 - { 30 - struct pcmcia_align_data *data = align_data; 31 - resource_size_t start; 32 - 33 - start = (res->start & ~data->mask) + data->offset; 34 - if (start < res->start) 35 - start += data->mask + 1; 36 - 37 - #ifdef CONFIG_X86 38 - if (res->flags & IORESOURCE_IO) { 39 - if (start & 0x300) 40 - start = (start + 0x3ff) & ~0x3ff; 41 - } 42 - #endif 43 - 44 - #ifdef CONFIG_M68K 45 - if (res->flags & IORESOURCE_IO) { 46 - if ((res->start + size - 1) >= 1024) 47 - start = res->end; 48 - } 49 - #endif 50 - 51 - return start; 52 - } 53 - 54 - 55 - static struct resource *__iodyn_find_io_region(struct pcmcia_socket *s, 56 - unsigned long base, int num, 57 - unsigned long align) 58 - { 59 - struct resource *res = pcmcia_make_resource(0, num, IORESOURCE_IO, 60 - dev_name(&s->dev)); 61 - struct pcmcia_align_data data; 62 - unsigned long min = base; 63 - int ret; 64 - 65 - data.mask = align - 1; 66 - data.offset = base & data.mask; 67 - 68 - #ifdef CONFIG_PCI 69 - if (s->cb_dev) { 70 - ret = pci_bus_alloc_resource(s->cb_dev->bus, res, num, 1, 71 - min, 0, pcmcia_align, &data); 72 - } else 73 - #endif 74 - ret = allocate_resource(&ioport_resource, res, num, min, ~0UL, 75 - 1, pcmcia_align, &data); 76 - 77 - if (ret != 0) { 78 - kfree(res); 79 - res = NULL; 80 - } 81 - return res; 82 - } 83 - 84 - static int iodyn_find_io(struct pcmcia_socket *s, unsigned int attr, 85 - unsigned int *base, unsigned int num, 86 - unsigned int align, struct resource **parent) 87 - { 88 - int i, ret = 0; 89 - 90 - /* Check for an already-allocated window that must conflict with 91 - * what was asked for. It is a hack because it does not catch all 92 - * potential conflicts, just the most obvious ones. 93 - */ 94 - for (i = 0; i < MAX_IO_WIN; i++) { 95 - if (!s->io[i].res) 96 - continue; 97 - 98 - if (!*base) 99 - continue; 100 - 101 - if ((s->io[i].res->start & (align-1)) == *base) 102 - return -EBUSY; 103 - } 104 - 105 - for (i = 0; i < MAX_IO_WIN; i++) { 106 - struct resource *res = s->io[i].res; 107 - unsigned int try; 108 - 109 - if (res && (res->flags & IORESOURCE_BITS) != 110 - (attr & IORESOURCE_BITS)) 111 - continue; 112 - 113 - if (!res) { 114 - if (align == 0) 115 - align = 0x10000; 116 - 117 - res = s->io[i].res = __iodyn_find_io_region(s, *base, 118 - num, align); 119 - if (!res) 120 - return -EINVAL; 121 - 122 - *base = res->start; 123 - s->io[i].res->flags = 124 - ((res->flags & ~IORESOURCE_BITS) | 125 - (attr & IORESOURCE_BITS)); 126 - s->io[i].InUse = num; 127 - *parent = res; 128 - return 0; 129 - } 130 - 131 - /* Try to extend top of window */ 132 - try = res->end + 1; 133 - if ((*base == 0) || (*base == try)) { 134 - if (adjust_resource(s->io[i].res, res->start, 135 - resource_size(res) + num)) 136 - continue; 137 - *base = try; 138 - s->io[i].InUse += num; 139 - *parent = res; 140 - return 0; 141 - } 142 - 143 - /* Try to extend bottom of window */ 144 - try = res->start - num; 145 - if ((*base == 0) || (*base == try)) { 146 - if (adjust_resource(s->io[i].res, 147 - res->start - num, 148 - resource_size(res) + num)) 149 - continue; 150 - *base = try; 151 - s->io[i].InUse += num; 152 - *parent = res; 153 - return 0; 154 - } 155 - } 156 - 157 - return -EINVAL; 158 - } 159 - 160 - 161 - struct pccard_resource_ops pccard_iodyn_ops = { 162 - .validate_mem = NULL, 163 - .find_io = iodyn_find_io, 164 - .find_mem = NULL, 165 - .init = static_init, 166 - .exit = NULL, 167 - }; 168 - EXPORT_SYMBOL(pccard_iodyn_ops);
+3 -1
drivers/pcmcia/rsrc_nonstatic.c
··· 375 375 376 376 if (validate && !s->fake_cis) { 377 377 /* move it to the validated data set */ 378 - add_interval(&s_data->mem_db_valid, base, size); 378 + ret = add_interval(&s_data->mem_db_valid, base, size); 379 + if (ret) 380 + return ret; 379 381 sub_interval(&s_data->mem_db, base, size); 380 382 } 381 383
+3 -2
drivers/pcmcia/socket_sysfs.c
··· 10 10 #include <linux/init.h> 11 11 #include <linux/kernel.h> 12 12 #include <linux/string.h> 13 + #include <linux/string_choices.h> 13 14 #include <linux/major.h> 14 15 #include <linux/errno.h> 15 16 #include <linux/mm.h> ··· 99 98 char *buf) 100 99 { 101 100 struct pcmcia_socket *s = to_socket(dev); 102 - return sysfs_emit(buf, "%s\n", s->state & SOCKET_SUSPEND ? "off" : "on"); 101 + return sysfs_emit(buf, "%s\n", str_off_on(s->state & SOCKET_SUSPEND)); 103 102 } 104 103 105 104 static ssize_t pccard_store_card_pm_state(struct device *dev, ··· 178 177 struct device_attribute *attr, char *buf) 179 178 { 180 179 struct pcmcia_socket *s = to_socket(dev); 181 - return sysfs_emit(buf, "%s\n", s->resource_setup_done ? "yes" : "no"); 180 + return sysfs_emit(buf, "%s\n", str_yes_no(s->resource_setup_done)); 182 181 } 183 182 184 183 static ssize_t pccard_store_resource(struct device *dev,
+1 -7
include/pcmcia/ss.h
··· 227 227 228 228 229 229 /* socket drivers must define the resource operations type they use. There 230 - * are three options: 230 + * are two options: 231 231 * - pccard_static_ops iomem and ioport areas are assigned statically 232 - * - pccard_iodyn_ops iomem areas is assigned statically, ioport 233 - * areas dynamically 234 - * If this option is selected, use 235 - * "select PCCARD_IODYN" in Kconfig. 236 232 * - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically. 237 233 * If this option is selected, use 238 234 * "select PCCARD_NONSTATIC" in Kconfig. ··· 236 240 */ 237 241 extern struct pccard_resource_ops pccard_static_ops; 238 242 #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) 239 - extern struct pccard_resource_ops pccard_iodyn_ops; 240 243 extern struct pccard_resource_ops pccard_nonstatic_ops; 241 244 #else 242 245 /* If PCMCIA is not used, but only CARDBUS, these functions are not used 243 246 * at all. Therefore, do not use the large (240K!) rsrc_nonstatic module 244 247 */ 245 - #define pccard_iodyn_ops pccard_static_ops 246 248 #define pccard_nonstatic_ops pccard_static_ops 247 249 #endif 248 250