Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Linus Torvalds committed Jun 23, 2015
2 parents d813335 + e8e68fd commit a394c6a
Show file tree
Hide file tree
Showing 15 changed files with 249 additions and 264 deletions.
5 changes: 2 additions & 3 deletions drivers/char/pcmcia/cm4040_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,8 @@ static int reader_config(struct pcmcia_device *link, int devno)

fail_rc = pcmcia_enable_device(link);
if (fail_rc != 0) {
dev_printk(KERN_INFO, &link->dev,
"pcmcia_enable_device failed 0x%x\n",
fail_rc);
dev_info(&link->dev, "pcmcia_enable_device failed 0x%x\n",
fail_rc);
goto cs_release;
}

Expand Down
50 changes: 19 additions & 31 deletions drivers/pcmcia/cistpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ static void __iomem *set_cis_map(struct pcmcia_socket *s,
mem->res = pcmcia_find_mem_region(0, s->map_size,
s->map_size, 0, s);
if (mem->res == NULL) {
dev_printk(KERN_NOTICE, &s->dev,
"cs: unable to map card memory!\n");
dev_notice(&s->dev, "cs: unable to map card memory!\n");
return NULL;
}
s->cis_virt = NULL;
Expand Down Expand Up @@ -381,8 +380,7 @@ int verify_cis_cache(struct pcmcia_socket *s)

buf = kmalloc(256, GFP_KERNEL);
if (buf == NULL) {
dev_printk(KERN_WARNING, &s->dev,
"no memory for verifying CIS\n");
dev_warn(&s->dev, "no memory for verifying CIS\n");
return -ENOMEM;
}
mutex_lock(&s->ops_mutex);
Expand Down Expand Up @@ -414,14 +412,14 @@ int pcmcia_replace_cis(struct pcmcia_socket *s,
const u8 *data, const size_t len)
{
if (len > CISTPL_MAX_CIS_SIZE) {
dev_printk(KERN_WARNING, &s->dev, "replacement CIS too big\n");
dev_warn(&s->dev, "replacement CIS too big\n");
return -EINVAL;
}
mutex_lock(&s->ops_mutex);
kfree(s->fake_cis);
s->fake_cis = kmalloc(len, GFP_KERNEL);
if (s->fake_cis == NULL) {
dev_printk(KERN_WARNING, &s->dev, "no memory to replace CIS\n");
dev_warn(&s->dev, "no memory to replace CIS\n");
mutex_unlock(&s->ops_mutex);
return -ENOMEM;
}
Expand All @@ -434,17 +432,17 @@ int pcmcia_replace_cis(struct pcmcia_socket *s,

/* The high-level CIS tuple services */

typedef struct tuple_flags {
struct tuple_flags {
u_int link_space:4;
u_int has_link:1;
u_int mfc_fn:3;
u_int space:4;
} tuple_flags;
};

#define LINK_SPACE(f) (((tuple_flags *)(&(f)))->link_space)
#define HAS_LINK(f) (((tuple_flags *)(&(f)))->has_link)
#define MFC_FN(f) (((tuple_flags *)(&(f)))->mfc_fn)
#define SPACE(f) (((tuple_flags *)(&(f)))->space)
#define LINK_SPACE(f) (((struct tuple_flags *)(&(f)))->link_space)
#define HAS_LINK(f) (((struct tuple_flags *)(&(f)))->has_link)
#define MFC_FN(f) (((struct tuple_flags *)(&(f)))->mfc_fn)
#define SPACE(f) (((struct tuple_flags *)(&(f)))->space)

int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function,
tuple_t *tuple)
Expand Down Expand Up @@ -1451,26 +1449,16 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info)
done:
/* invalidate CIS cache on failure */
if (!dev_ok || !ident_ok || !count) {
#if defined(CONFIG_MTD_PCMCIA_ANONYMOUS)
/* Set up as an anonymous card. If we don't have anonymous
memory support then just error the card as there is no
point trying to second guess.
Note: some cards have just a device entry, it may be
worth extending support to cover these in future */
if (!dev_ok || !ident_ok) {
dev_info(&s->dev, "no CIS, assuming an anonymous memory card.\n");
pcmcia_replace_cis(s, "\xFF", 1);
count = 1;
ret = 0;
} else
#endif
{
mutex_lock(&s->ops_mutex);
destroy_cis_cache(s);
mutex_unlock(&s->ops_mutex);
mutex_lock(&s->ops_mutex);
destroy_cis_cache(s);
mutex_unlock(&s->ops_mutex);
/* We differentiate between dev_ok, ident_ok and count
failures to allow for an override for anonymous cards
in ds.c */
if (!dev_ok || !ident_ok)
ret = -EIO;
}
else
ret = -EFAULT;
}

if (info)
Expand Down
29 changes: 12 additions & 17 deletions drivers/pcmcia/cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)

wait_for_completion(&socket->thread_done);
if (!socket->thread) {
dev_printk(KERN_WARNING, &socket->dev,
"PCMCIA: warning: socket thread did not start\n");
dev_warn(&socket->dev,
"PCMCIA: warning: socket thread did not start\n");
return -EIO;
}

Expand Down Expand Up @@ -275,7 +275,7 @@ static int socket_reset(struct pcmcia_socket *skt)
msleep(unreset_check * 10);
}

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

Expand Down Expand Up @@ -325,8 +325,8 @@ static void socket_shutdown(struct pcmcia_socket *s)

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

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

if (status & SS_PENDING) {
dev_printk(KERN_ERR, &skt->dev,
"voltage interrogation timed out.\n");
dev_err(&skt->dev, "voltage interrogation timed out\n");
return -ETIMEDOUT;
}

if (status & SS_CARDBUS) {
if (!(skt->features & SS_CAP_CARDBUS)) {
dev_printk(KERN_ERR, &skt->dev,
"cardbus cards are not supported.\n");
dev_err(&skt->dev, "cardbus cards are not supported\n");
return -EINVAL;
}
skt->state |= SOCKET_CARDBUS;
Expand All @@ -379,7 +377,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
else if (!(status & SS_XVCARD))
skt->socket.Vcc = skt->socket.Vpp = 50;
else {
dev_printk(KERN_ERR, &skt->dev, "unsupported voltage key.\n");
dev_err(&skt->dev, "unsupported voltage key\n");
return -EIO;
}

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

skt->ops->get_status(skt, &status);
if (!(status & SS_POWERON)) {
dev_printk(KERN_ERR, &skt->dev, "unable to apply power.\n");
dev_err(&skt->dev, "unable to apply power\n");
return -EIO;
}

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

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

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

static void socket_remove(struct pcmcia_socket *skt)
{
dev_printk(KERN_NOTICE, &skt->dev,
"pccard: card ejected from slot %d\n", skt->sock);
dev_notice(&skt->dev, "pccard: card ejected from slot %d\n", skt->sock);
socket_shutdown(skt);
}

Expand Down Expand Up @@ -605,8 +601,7 @@ static int pccardd(void *__skt)
/* register with the device core */
ret = device_register(&skt->dev);
if (ret) {
dev_printk(KERN_WARNING, &skt->dev,
"PCMCIA: unable to register socket\n");
dev_warn(&skt->dev, "PCMCIA: unable to register socket\n");
skt->thread = NULL;
complete(&skt->thread_done);
return 0;
Expand Down
Loading

0 comments on commit a394c6a

Please sign in to comment.