Skip to content

Commit a394c6a

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia
Pull PCMCIA update from Dominik Brodowski: "A few PCMCIA fixes and cleanups are available in the PCMCIA tree. Most of them are trivial and self-explanatory. Of particular note are the last three patches which add an important hardware quirk for Toshiba ToPIC95 sockets (or BIOS breakage on systems with these sockets), fix resource leaks in yenta_socket enable/disable call paths, and fix a regression caused by patch 1c6c9b1 since v4.0. Alan stated he is OK with me pushing this patch upstream. Once it works out well in your tree, I will push it to stable for 4.0/4.1 as well" * git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia: pcmcia: do not break rsrc_nonstatic when handling anonymous cards pcmcia: Fix resource leaks in yenta_probe() and _close() Disable write buffering on Toshiba ToPIC95 pcmcia: Convert dev_printk to dev_<level> pcmcia/vrc4171: Remove typedefs for enums and struct pcmcia: Remove typedef in structs and emum pcmcia: Remove typedef tuple_flags drivers: pcmcia: electra_cf.c fix checkpatch error and warnings drivers: pcmcia: ds.c fix checkpatch errors PCMCIA: Remove commented references to dead class_device_create_file() drivers/pcmcia/electra_cf.c: add missing iounmap and kfree pcmcia: replace open-coded ARRAY_SIZE with macro
2 parents d813335 + e8e68fd commit a394c6a

File tree

15 files changed

+249
-264
lines changed

15 files changed

+249
-264
lines changed

drivers/char/pcmcia/cm4040_cs.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,8 @@ static int reader_config(struct pcmcia_device *link, int devno)
532532

533533
fail_rc = pcmcia_enable_device(link);
534534
if (fail_rc != 0) {
535-
dev_printk(KERN_INFO, &link->dev,
536-
"pcmcia_enable_device failed 0x%x\n",
537-
fail_rc);
535+
dev_info(&link->dev, "pcmcia_enable_device failed 0x%x\n",
536+
fail_rc);
538537
goto cs_release;
539538
}
540539

drivers/pcmcia/cistpl.c

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ static void __iomem *set_cis_map(struct pcmcia_socket *s,
9494
mem->res = pcmcia_find_mem_region(0, s->map_size,
9595
s->map_size, 0, s);
9696
if (mem->res == NULL) {
97-
dev_printk(KERN_NOTICE, &s->dev,
98-
"cs: unable to map card memory!\n");
97+
dev_notice(&s->dev, "cs: unable to map card memory!\n");
9998
return NULL;
10099
}
101100
s->cis_virt = NULL;
@@ -381,8 +380,7 @@ int verify_cis_cache(struct pcmcia_socket *s)
381380

382381
buf = kmalloc(256, GFP_KERNEL);
383382
if (buf == NULL) {
384-
dev_printk(KERN_WARNING, &s->dev,
385-
"no memory for verifying CIS\n");
383+
dev_warn(&s->dev, "no memory for verifying CIS\n");
386384
return -ENOMEM;
387385
}
388386
mutex_lock(&s->ops_mutex);
@@ -414,14 +412,14 @@ int pcmcia_replace_cis(struct pcmcia_socket *s,
414412
const u8 *data, const size_t len)
415413
{
416414
if (len > CISTPL_MAX_CIS_SIZE) {
417-
dev_printk(KERN_WARNING, &s->dev, "replacement CIS too big\n");
415+
dev_warn(&s->dev, "replacement CIS too big\n");
418416
return -EINVAL;
419417
}
420418
mutex_lock(&s->ops_mutex);
421419
kfree(s->fake_cis);
422420
s->fake_cis = kmalloc(len, GFP_KERNEL);
423421
if (s->fake_cis == NULL) {
424-
dev_printk(KERN_WARNING, &s->dev, "no memory to replace CIS\n");
422+
dev_warn(&s->dev, "no memory to replace CIS\n");
425423
mutex_unlock(&s->ops_mutex);
426424
return -ENOMEM;
427425
}
@@ -434,17 +432,17 @@ int pcmcia_replace_cis(struct pcmcia_socket *s,
434432

435433
/* The high-level CIS tuple services */
436434

437-
typedef struct tuple_flags {
435+
struct tuple_flags {
438436
u_int link_space:4;
439437
u_int has_link:1;
440438
u_int mfc_fn:3;
441439
u_int space:4;
442-
} tuple_flags;
440+
};
443441

444-
#define LINK_SPACE(f) (((tuple_flags *)(&(f)))->link_space)
445-
#define HAS_LINK(f) (((tuple_flags *)(&(f)))->has_link)
446-
#define MFC_FN(f) (((tuple_flags *)(&(f)))->mfc_fn)
447-
#define SPACE(f) (((tuple_flags *)(&(f)))->space)
442+
#define LINK_SPACE(f) (((struct tuple_flags *)(&(f)))->link_space)
443+
#define HAS_LINK(f) (((struct tuple_flags *)(&(f)))->has_link)
444+
#define MFC_FN(f) (((struct tuple_flags *)(&(f)))->mfc_fn)
445+
#define SPACE(f) (((struct tuple_flags *)(&(f)))->space)
448446

449447
int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function,
450448
tuple_t *tuple)
@@ -1451,26 +1449,16 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
14511449
done:
14521450
/* invalidate CIS cache on failure */
14531451
if (!dev_ok || !ident_ok || !count) {
1454-
#if defined(CONFIG_MTD_PCMCIA_ANONYMOUS)
1455-
/* Set up as an anonymous card. If we don't have anonymous
1456-
memory support then just error the card as there is no
1457-
point trying to second guess.
1458-
1459-
Note: some cards have just a device entry, it may be
1460-
worth extending support to cover these in future */
1461-
if (!dev_ok || !ident_ok) {
1462-
dev_info(&s->dev, "no CIS, assuming an anonymous memory card.\n");
1463-
pcmcia_replace_cis(s, "\xFF", 1);
1464-
count = 1;
1465-
ret = 0;
1466-
} else
1467-
#endif
1468-
{
1469-
mutex_lock(&s->ops_mutex);
1470-
destroy_cis_cache(s);
1471-
mutex_unlock(&s->ops_mutex);
1452+
mutex_lock(&s->ops_mutex);
1453+
destroy_cis_cache(s);
1454+
mutex_unlock(&s->ops_mutex);
1455+
/* We differentiate between dev_ok, ident_ok and count
1456+
failures to allow for an override for anonymous cards
1457+
in ds.c */
1458+
if (!dev_ok || !ident_ok)
14721459
ret = -EIO;
1473-
}
1460+
else
1461+
ret = -EFAULT;
14741462
}
14751463

14761464
if (info)

drivers/pcmcia/cs.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
177177

178178
wait_for_completion(&socket->thread_done);
179179
if (!socket->thread) {
180-
dev_printk(KERN_WARNING, &socket->dev,
181-
"PCMCIA: warning: socket thread did not start\n");
180+
dev_warn(&socket->dev,
181+
"PCMCIA: warning: socket thread did not start\n");
182182
return -EIO;
183183
}
184184

@@ -275,7 +275,7 @@ static int socket_reset(struct pcmcia_socket *skt)
275275
msleep(unreset_check * 10);
276276
}
277277

278-
dev_printk(KERN_ERR, &skt->dev, "time out after reset.\n");
278+
dev_err(&skt->dev, "time out after reset\n");
279279
return -ETIMEDOUT;
280280
}
281281

@@ -325,8 +325,8 @@ static void socket_shutdown(struct pcmcia_socket *s)
325325

326326
s->ops->get_status(s, &status);
327327
if (status & SS_POWERON) {
328-
dev_printk(KERN_ERR, &s->dev,
329-
"*** DANGER *** unable to remove socket power\n");
328+
dev_err(&s->dev,
329+
"*** DANGER *** unable to remove socket power\n");
330330
}
331331

332332
s->state &= ~SOCKET_INUSE;
@@ -356,15 +356,13 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
356356
}
357357

358358
if (status & SS_PENDING) {
359-
dev_printk(KERN_ERR, &skt->dev,
360-
"voltage interrogation timed out.\n");
359+
dev_err(&skt->dev, "voltage interrogation timed out\n");
361360
return -ETIMEDOUT;
362361
}
363362

364363
if (status & SS_CARDBUS) {
365364
if (!(skt->features & SS_CAP_CARDBUS)) {
366-
dev_printk(KERN_ERR, &skt->dev,
367-
"cardbus cards are not supported.\n");
365+
dev_err(&skt->dev, "cardbus cards are not supported\n");
368366
return -EINVAL;
369367
}
370368
skt->state |= SOCKET_CARDBUS;
@@ -379,7 +377,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
379377
else if (!(status & SS_XVCARD))
380378
skt->socket.Vcc = skt->socket.Vpp = 50;
381379
else {
382-
dev_printk(KERN_ERR, &skt->dev, "unsupported voltage key.\n");
380+
dev_err(&skt->dev, "unsupported voltage key\n");
383381
return -EIO;
384382
}
385383

@@ -396,7 +394,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
396394

397395
skt->ops->get_status(skt, &status);
398396
if (!(status & SS_POWERON)) {
399-
dev_printk(KERN_ERR, &skt->dev, "unable to apply power.\n");
397+
dev_err(&skt->dev, "unable to apply power\n");
400398
return -EIO;
401399
}
402400

@@ -429,8 +427,7 @@ static int socket_insert(struct pcmcia_socket *skt)
429427
if (ret == 0) {
430428
skt->state |= SOCKET_PRESENT;
431429

432-
dev_printk(KERN_NOTICE, &skt->dev,
433-
"pccard: %s card inserted into slot %d\n",
430+
dev_notice(&skt->dev, "pccard: %s card inserted into slot %d\n",
434431
(skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA",
435432
skt->sock);
436433

@@ -558,8 +555,7 @@ static int socket_resume(struct pcmcia_socket *skt)
558555

559556
static void socket_remove(struct pcmcia_socket *skt)
560557
{
561-
dev_printk(KERN_NOTICE, &skt->dev,
562-
"pccard: card ejected from slot %d\n", skt->sock);
558+
dev_notice(&skt->dev, "pccard: card ejected from slot %d\n", skt->sock);
563559
socket_shutdown(skt);
564560
}
565561

@@ -605,8 +601,7 @@ static int pccardd(void *__skt)
605601
/* register with the device core */
606602
ret = device_register(&skt->dev);
607603
if (ret) {
608-
dev_printk(KERN_WARNING, &skt->dev,
609-
"PCMCIA: unable to register socket\n");
604+
dev_warn(&skt->dev, "PCMCIA: unable to register socket\n");
610605
skt->thread = NULL;
611606
complete(&skt->thread_done);
612607
return 0;

0 commit comments

Comments
 (0)