From: Dmitry Torokhov <dtor_core@ameritech.net>
To: Russell King <rmk+lkml@arm.linux.org.uk>
Cc: Marcel Holtmann <marcel@holtmann.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Simon Kelley <simon@thekelleys.org.uk>
Subject: Re: [OOPS/HACK] atmel_cs and the latest changes in sysfs/symlink.c
Date: Sun, 25 Apr 2004 16:53:53 -0500 [thread overview]
Message-ID: <200404251653.55385.dtor_core@ameritech.net> (raw)
In-Reply-To: <20040423213916.D2896@flint.arm.linux.org.uk>
On Friday 23 April 2004 03:39 pm, Russell King wrote:
> On Fri, Apr 23, 2004 at 10:14:24PM +0200, Marcel Holtmann wrote:
> > should we apply the pcmcia_get_sys_device() patch from Dmitry for now to
> > fix the current drivers that need a device for loading the firmware?
>
> I don't think so - it obtains the struct device for the bridge itself
> which has nothing to do with the card inserted in the slot.
>
Yes, my bad... I wonder if something like the patch below could be useful
for now (although it created only one device entry even if card has multiple
functions so we really need another device for every function):
===== ss.h 1.27 vs edited =====
--- 1.27/include/pcmcia/ss.h Sat Sep 6 16:32:55 2003
+++ edited/ss.h Sun Apr 25 15:10:40 2004
@@ -196,7 +196,6 @@
/* deprecated */
unsigned int sock; /* socket number */
-
/* socket capabilities */
u_int features;
u_int irq_mask;
@@ -232,6 +231,7 @@
/* socket device */
struct class_device dev;
+ struct device *card_dev;
void *driver_data; /* data internal to the socket driver */
};
===== cs.c 1.78 vs edited =====
--- 1.78/drivers/pcmcia/cs.c Mon Apr 19 03:12:13 2004
+++ edited/cs.c Sun Apr 25 15:14:36 2004
@@ -60,6 +60,7 @@
#include <pcmcia/bulkmem.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/cisreg.h>
+#include <pcmcia/ds.h>
#include "cs_internal.h"
#ifdef CONFIG_PCI
@@ -324,6 +325,40 @@
}
EXPORT_SYMBOL(pcmcia_get_socket_by_nr);
+static void release_card_device(struct device *dev)
+{
+ kfree(dev);
+}
+
+static void register_card_device(struct pcmcia_socket *skt)
+{
+ struct device *dev;
+
+ WARN_ON(skt->card_dev);
+
+ skt->card_dev = dev = kmalloc(sizeof(struct device), GFP_KERNEL);
+ if (dev) {
+
+ memset(dev, 0, sizeof(struct device));
+
+ dev->parent = skt->dev.dev;
+ dev->driver = NULL;
+ dev->bus = &pcmcia_bus_type;
+ dev->release = &release_card_device;
+
+ snprintf(dev->bus_id, sizeof(dev->bus_id), "pccard%d", skt->sock);
+
+ device_register(dev);
+ }
+}
+
+static void unregister_card_device(struct pcmcia_socket *skt)
+{
+ if (skt->card_dev) {
+ device_unregister(skt->card_dev);
+ skt->card_dev = NULL;
+ }
+}
/*======================================================================
@@ -574,8 +609,11 @@
#endif
cs_dbg(skt, 4, "insert done\n");
+ register_card_device(skt);
+
send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
} else {
+ unregister_card_device(skt);
socket_shutdown(skt);
cs_socket_put(skt);
}
@@ -596,6 +634,7 @@
return CS_SUCCESS;
}
+
/*
* Resume a socket. If a card is present, verify its CIS against
* our cached copy. If they are different, the card has been
@@ -620,11 +659,14 @@
if (verify_cis_cache(skt) != 0) {
socket_remove_drivers(skt);
destroy_cis_cache(skt);
+ unregister_card_device(skt);
+ register_card_device(skt);
send_event(skt, CS_EVENT_CARD_INSERTION, CS_EVENT_PRI_LOW);
} else {
send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
}
} else {
+ unregister_card_device(skt);
socket_shutdown(skt);
cs_socket_put(skt);
}
@@ -636,6 +678,7 @@
static void socket_remove(struct pcmcia_socket *skt)
{
+ unregister_card_device(skt);
socket_shutdown(skt);
cs_socket_put(skt);
}
next prev parent reply other threads:[~2004-04-25 21:54 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-23 6:42 [OOPS/HACK] atmel_cs and the latest changes in sysfs/symlink.c Dmitry Torokhov
2004-04-23 12:25 ` Marcel Holtmann
2004-04-23 13:02 ` Dmitry Torokhov
2004-04-23 14:26 ` Marcel Holtmann
2004-04-23 16:55 ` Dmitry Torokhov
2004-04-23 17:16 ` Greg KH
2004-04-23 18:50 ` Marcel Holtmann
2004-04-23 19:46 ` Greg KH
2004-04-23 20:35 ` Russell King
2004-04-23 21:02 ` Marcel Holtmann
2004-04-23 15:31 ` Greg KH
2004-04-23 17:19 ` Greg KH
2004-04-23 18:03 ` Greg KH
2004-04-24 6:44 ` Dmitry Torokhov
2004-04-25 2:49 ` Greg KH
2004-04-25 21:48 ` Dmitry Torokhov
2004-05-04 21:04 ` Greg KH
2004-05-05 7:08 ` Dmitry Torokhov
2004-05-07 23:25 ` Greg KH
2004-04-26 10:19 ` Vojtech Pavlik
2004-04-23 19:55 ` Russell King
2004-04-23 20:14 ` Marcel Holtmann
2004-04-23 20:39 ` Russell King
2004-04-25 21:53 ` Dmitry Torokhov [this message]
2004-04-25 22:58 ` Russell King
2004-04-26 10:35 ` Marcel Holtmann
2004-04-26 12:32 ` Dmitry Torokhov
2004-04-26 13:09 ` Marcel Holtmann
2004-04-27 5:57 ` Dmitry Torokhov
2004-04-26 12:26 ` Dmitry Torokhov
2004-04-23 15:28 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200404251653.55385.dtor_core@ameritech.net \
--to=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=rmk+lkml@arm.linux.org.uk \
--cc=simon@thekelleys.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox