Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134412
b: refs/heads/master
c: 0c2bec9
h: refs/heads/master
v: v3
  • Loading branch information
Mike Rapoport authored and John W. Linville committed Feb 9, 2009
1 parent 7f096dd commit 1c6ffbf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d43e87868f67c5b52defd8d82bc3f54347ed2408
refs/heads/master: 0c2bec96945ccfc4a58a88d73531e392972ba6c5
15 changes: 15 additions & 0 deletions trunk/drivers/net/wireless/libertas/if_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct if_spi_packet {
struct if_spi_card {
struct spi_device *spi;
struct lbs_private *priv;
struct libertas_spi_platform_data *pdata;

char helper_fw_name[FIRMWARE_NAME_MAX];
char main_fw_name[FIRMWARE_NAME_MAX];
Expand Down Expand Up @@ -1022,13 +1023,25 @@ static int __devinit if_spi_probe(struct spi_device *spi)

lbs_deb_enter(LBS_DEB_SPI);

if (!pdata) {
err = -EINVAL;
goto out;
}

if (pdata->setup) {
err = pdata->setup(spi);
if (err)
goto out;
}

/* Allocate card structure to represent this specific device */
card = kzalloc(sizeof(struct if_spi_card), GFP_KERNEL);
if (!card) {
err = -ENOMEM;
goto out;
}
spi_set_drvdata(spi, card);
card->pdata = pdata;
card->spi = spi;
card->gpio_cs = pdata->gpio_cs;
card->prev_xfer_time = jiffies;
Expand Down Expand Up @@ -1158,6 +1171,8 @@ static int __devexit libertas_spi_remove(struct spi_device *spi)
if_spi_terminate_spi_thread(card);
lbs_remove_card(priv); /* will call free_netdev */
gpio_free(card->gpio_cs);
if (card->pdata->teardown)
card->pdata->teardown(spi);
free_if_spi_card(card);
lbs_deb_leave(LBS_DEB_SPI);
return 0;
Expand Down
7 changes: 7 additions & 0 deletions trunk/include/linux/spi/libertas_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
*/
#ifndef _LIBERTAS_SPI_H_
#define _LIBERTAS_SPI_H_

struct spi_device;

struct libertas_spi_platform_data {
/* There are two ways to read data from the WLAN module's SPI
* interface. Setting 0 or 1 here controls which one is used.
Expand All @@ -21,5 +24,9 @@ struct libertas_spi_platform_data {

/* GPIO number to use as chip select */
u16 gpio_cs;

/* Board specific setup/teardown */
int (*setup)(struct spi_device *spi);
int (*teardown)(struct spi_device *spi);
};
#endif

0 comments on commit 1c6ffbf

Please sign in to comment.