Merge branch 'ieee802154-for-davem-2018-10-04' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan-next
Stefan Schmidt says: ==================== pull-request: ieee802154-next 2018-10-04 An update from ieee802154 for *net-next* A very quite cycle in the ieee802154 subsystem. We only have two cleanup patches for this pull request. Xue removed the platform_data struct handling from the mcr20a driver and Alexander cleaned up some left overs in the hwsim driver. Please pull, or let me know if there are any problems. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
6a5e6b1180
|
@ -37,8 +37,6 @@ MODULE_LICENSE("GPL");
|
||||||
static LIST_HEAD(hwsim_phys);
|
static LIST_HEAD(hwsim_phys);
|
||||||
static DEFINE_MUTEX(hwsim_phys_lock);
|
static DEFINE_MUTEX(hwsim_phys_lock);
|
||||||
|
|
||||||
static LIST_HEAD(hwsim_ifup_phys);
|
|
||||||
|
|
||||||
static struct platform_device *mac802154hwsim_dev;
|
static struct platform_device *mac802154hwsim_dev;
|
||||||
|
|
||||||
/* MAC802154_HWSIM netlink family */
|
/* MAC802154_HWSIM netlink family */
|
||||||
|
@ -85,7 +83,6 @@ struct hwsim_phy {
|
||||||
struct list_head edges;
|
struct list_head edges;
|
||||||
|
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
struct list_head list_ifup;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int hwsim_add_one(struct genl_info *info, struct device *dev,
|
static int hwsim_add_one(struct genl_info *info, struct device *dev,
|
||||||
|
@ -159,9 +156,6 @@ static int hwsim_hw_start(struct ieee802154_hw *hw)
|
||||||
struct hwsim_phy *phy = hw->priv;
|
struct hwsim_phy *phy = hw->priv;
|
||||||
|
|
||||||
phy->suspended = false;
|
phy->suspended = false;
|
||||||
list_add_rcu(&phy->list_ifup, &hwsim_ifup_phys);
|
|
||||||
synchronize_rcu();
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,8 +164,6 @@ static void hwsim_hw_stop(struct ieee802154_hw *hw)
|
||||||
struct hwsim_phy *phy = hw->priv;
|
struct hwsim_phy *phy = hw->priv;
|
||||||
|
|
||||||
phy->suspended = true;
|
phy->suspended = true;
|
||||||
list_del_rcu(&phy->list_ifup);
|
|
||||||
synchronize_rcu();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -132,11 +132,6 @@ static const struct reg_sequence mar20a_iar_overwrites[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MCR20A_VALID_CHANNELS (0x07FFF800)
|
#define MCR20A_VALID_CHANNELS (0x07FFF800)
|
||||||
|
|
||||||
struct mcr20a_platform_data {
|
|
||||||
int rst_gpio;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define MCR20A_MAX_BUF (127)
|
#define MCR20A_MAX_BUF (127)
|
||||||
|
|
||||||
#define printdev(X) (&X->spi->dev)
|
#define printdev(X) (&X->spi->dev)
|
||||||
|
@ -412,7 +407,6 @@ struct mcr20a_local {
|
||||||
struct spi_device *spi;
|
struct spi_device *spi;
|
||||||
|
|
||||||
struct ieee802154_hw *hw;
|
struct ieee802154_hw *hw;
|
||||||
struct mcr20a_platform_data *pdata;
|
|
||||||
struct regmap *regmap_dar;
|
struct regmap *regmap_dar;
|
||||||
struct regmap *regmap_iar;
|
struct regmap *regmap_iar;
|
||||||
|
|
||||||
|
@ -976,20 +970,6 @@ static irqreturn_t mcr20a_irq_isr(int irq, void *data)
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mcr20a_get_platform_data(struct spi_device *spi,
|
|
||||||
struct mcr20a_platform_data *pdata)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
if (!spi->dev.of_node)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
pdata->rst_gpio = of_get_named_gpio(spi->dev.of_node, "rst_b-gpio", 0);
|
|
||||||
dev_dbg(&spi->dev, "rst_b-gpio: %d\n", pdata->rst_gpio);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void mcr20a_hw_setup(struct mcr20a_local *lp)
|
static void mcr20a_hw_setup(struct mcr20a_local *lp)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
@ -1249,7 +1229,7 @@ mcr20a_probe(struct spi_device *spi)
|
||||||
{
|
{
|
||||||
struct ieee802154_hw *hw;
|
struct ieee802154_hw *hw;
|
||||||
struct mcr20a_local *lp;
|
struct mcr20a_local *lp;
|
||||||
struct mcr20a_platform_data *pdata;
|
struct gpio_desc *rst_b;
|
||||||
int irq_type;
|
int irq_type;
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
|
|
||||||
|
@ -1260,48 +1240,32 @@ mcr20a_probe(struct spi_device *spi)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdata = kmalloc(sizeof(*pdata), GFP_KERNEL);
|
rst_b = devm_gpiod_get(&spi->dev, "rst_b", GPIOD_OUT_HIGH);
|
||||||
if (!pdata)
|
if (IS_ERR(rst_b)) {
|
||||||
return -ENOMEM;
|
ret = PTR_ERR(rst_b);
|
||||||
|
if (ret != -EPROBE_DEFER)
|
||||||
/* set mcr20a platform data */
|
dev_err(&spi->dev, "Failed to get 'rst_b' gpio: %d", ret);
|
||||||
ret = mcr20a_get_platform_data(spi, pdata);
|
return ret;
|
||||||
if (ret < 0) {
|
|
||||||
dev_crit(&spi->dev, "mcr20a_get_platform_data failed.\n");
|
|
||||||
goto free_pdata;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* init reset gpio */
|
|
||||||
if (gpio_is_valid(pdata->rst_gpio)) {
|
|
||||||
ret = devm_gpio_request_one(&spi->dev, pdata->rst_gpio,
|
|
||||||
GPIOF_OUT_INIT_HIGH, "reset");
|
|
||||||
if (ret)
|
|
||||||
goto free_pdata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset mcr20a */
|
/* reset mcr20a */
|
||||||
if (gpio_is_valid(pdata->rst_gpio)) {
|
usleep_range(10, 20);
|
||||||
usleep_range(10, 20);
|
gpiod_set_value_cansleep(rst_b, 1);
|
||||||
gpio_set_value_cansleep(pdata->rst_gpio, 0);
|
usleep_range(10, 20);
|
||||||
usleep_range(10, 20);
|
gpiod_set_value_cansleep(rst_b, 0);
|
||||||
gpio_set_value_cansleep(pdata->rst_gpio, 1);
|
usleep_range(120, 240);
|
||||||
usleep_range(120, 240);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* allocate ieee802154_hw and private data */
|
/* allocate ieee802154_hw and private data */
|
||||||
hw = ieee802154_alloc_hw(sizeof(*lp), &mcr20a_hw_ops);
|
hw = ieee802154_alloc_hw(sizeof(*lp), &mcr20a_hw_ops);
|
||||||
if (!hw) {
|
if (!hw) {
|
||||||
dev_crit(&spi->dev, "ieee802154_alloc_hw failed\n");
|
dev_crit(&spi->dev, "ieee802154_alloc_hw failed\n");
|
||||||
ret = -ENOMEM;
|
return ret;
|
||||||
goto free_pdata;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* init mcr20a local data */
|
/* init mcr20a local data */
|
||||||
lp = hw->priv;
|
lp = hw->priv;
|
||||||
lp->hw = hw;
|
lp->hw = hw;
|
||||||
lp->spi = spi;
|
lp->spi = spi;
|
||||||
lp->spi->dev.platform_data = pdata;
|
|
||||||
lp->pdata = pdata;
|
|
||||||
|
|
||||||
/* init ieee802154_hw */
|
/* init ieee802154_hw */
|
||||||
hw->parent = &spi->dev;
|
hw->parent = &spi->dev;
|
||||||
|
@ -1370,8 +1334,6 @@ mcr20a_probe(struct spi_device *spi)
|
||||||
|
|
||||||
free_dev:
|
free_dev:
|
||||||
ieee802154_free_hw(lp->hw);
|
ieee802154_free_hw(lp->hw);
|
||||||
free_pdata:
|
|
||||||
kfree(pdata);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue