diff options
Diffstat (limited to 'drivers/pnp/card.c')
-rw-r--r-- | drivers/pnp/card.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index d606a163b1d7..a762a4176736 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c | |||
@@ -151,6 +151,31 @@ static void pnp_release_card(struct device *dmdev) | |||
151 | kfree(card); | 151 | kfree(card); |
152 | } | 152 | } |
153 | 153 | ||
154 | struct pnp_card *pnp_alloc_card(struct pnp_protocol *protocol, int id, char *pnpid) | ||
155 | { | ||
156 | struct pnp_card *card; | ||
157 | struct pnp_id *dev_id; | ||
158 | |||
159 | card = kzalloc(sizeof(struct pnp_card), GFP_KERNEL); | ||
160 | if (!card) | ||
161 | return NULL; | ||
162 | |||
163 | card->protocol = protocol; | ||
164 | card->number = id; | ||
165 | |||
166 | card->dev.parent = &card->protocol->dev; | ||
167 | sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, | ||
168 | card->number); | ||
169 | |||
170 | dev_id = pnp_add_card_id(card, pnpid); | ||
171 | if (!dev_id) { | ||
172 | kfree(card); | ||
173 | return NULL; | ||
174 | } | ||
175 | |||
176 | return card; | ||
177 | } | ||
178 | |||
154 | static ssize_t pnp_show_card_name(struct device *dmdev, | 179 | static ssize_t pnp_show_card_name(struct device *dmdev, |
155 | struct device_attribute *attr, char *buf) | 180 | struct device_attribute *attr, char *buf) |
156 | { | 181 | { |
@@ -206,9 +231,6 @@ int pnp_add_card(struct pnp_card *card) | |||
206 | int error; | 231 | int error; |
207 | struct list_head *pos, *temp; | 232 | struct list_head *pos, *temp; |
208 | 233 | ||
209 | sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, | ||
210 | card->number); | ||
211 | card->dev.parent = &card->protocol->dev; | ||
212 | card->dev.bus = NULL; | 234 | card->dev.bus = NULL; |
213 | card->dev.release = &pnp_release_card; | 235 | card->dev.release = &pnp_release_card; |
214 | error = device_register(&card->dev); | 236 | error = device_register(&card->dev); |