Re: [Linux-zigbee-devel] [PATCH] 6lowpan: nuke net_ieee802154_lowpan() accessor when 6lowpan is disabled

2014-04-24 Thread David Miller
From: "Luis R. Rodriguez" 
Date: Tue, 22 Apr 2014 12:03:58 -0700

> From: "Luis R. Rodriguez" 
> 
> Johannes noted this is not needed, all of the fragment
> accessors don't need CONFIG_NET_NS. This goes test compiled with
> CONFIG_BT_6LOWPAN=y and a disabled CONFIG_NET_NS.
> 
> CC: Alexander Smirnov 
> Cc: Dmitry Eremin-Solenikov 
> Cc: linux-zigbee-devel@lists.sourceforge.net
> Cc: David S. Miller" 
> Cc: net...@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org
> Cc: Johannes Berg 
> Signed-off-by: Luis R. Rodriguez 

Applied, thanks Luis.

--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


Re: [Linux-zigbee-devel] [PATCH] 6lowpan: nuke net_ieee802154_lowpan() accessor when 6lowpan is disabled

2014-04-24 Thread Alexander Aring
Hi,

On Tue, Apr 22, 2014 at 12:03:58PM -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" 
> 
> Johannes noted this is not needed, all of the fragment
> accessors don't need CONFIG_NET_NS. This goes test compiled with
> CONFIG_BT_6LOWPAN=y and a disabled CONFIG_NET_NS.
> 

a little note about this here. There exists two 6LoWPAN standard. One
for bluetooth low energy and one for IEEE 802.15.4.

The actual namespace is only for IEEE 802.15.4, because we need
fragmentation there. 6LoWPAN fragmentation for bluetooth low energy is
already handled by the MAC-Layer. So this has nothing to do with
CONFIG_BT_6LOWPAN.

- Alex

--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 00/14] at86rf230 cleanup

2014-04-24 Thread Alexander Aring
Hi,

this is the first patch series to cleanup the at86rf230 driver. Later I want
to implement regmap and a asynchron spi handling for transmit and receiving
frames.

- Alex

Alexander Aring (14):
  at86rf230: use irq_get_trigger_type
  devicetree: add at86rf230 bindings
  at86rf230: remove irq_type in request_irq
  at86rf230: use devm_request_irq
  at86rf230: use devm_gpio_request_one
  at86rf230: add missing MODULE_DEVICE_TABLE
  at86rf230: make of_device_id const
  at86rf230: add at86rf230_device_id table
  at86rf230: remove #ifdef CONFIG_OF
  at86rf230: remove unnecessary assign
  at86rf230: reset irq line before irq request
  at86rf230: remove unnecessary spi_set_drvdata
  at86rf230: remove unnecessary state read
  at86rf230: remove function for setting irq polarity

 .../bindings/net/ieee802154/at86rf230.txt  |  23 
 drivers/net/ieee802154/at86rf230.c | 133 +++--
 include/linux/spi/at86rf230.h  |  14 ---
 3 files changed, 65 insertions(+), 105 deletions(-)
 create mode 100644 
Documentation/devicetree/bindings/net/ieee802154/at86rf230.txt

-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 01/14] at86rf230: use irq_get_trigger_type

2014-04-24 Thread Alexander Aring
This patch removes the platform data for the irq_type. We use instead
the irq_get_trigger_type function to get these flags which should
already configured by the interrupt controller.

Signed-off-by: Alexander Aring 
---
 drivers/net/ieee802154/at86rf230.c | 28 
 include/linux/spi/at86rf230.h  | 14 --
 2 files changed, 8 insertions(+), 34 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index e36f194..17b9c9a 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -970,8 +971,7 @@ static int at86rf230_irq_polarity(struct at86rf230_local 
*lp, int pol)
 
 static int at86rf230_hw_init(struct at86rf230_local *lp)
 {
-   struct at86rf230_platform_data *pdata = lp->spi->dev.platform_data;
-   int rc, irq_pol;
+   int rc, irq_pol, irq_type;
u8 status;
u8 csma_seed[2];
 
@@ -983,8 +983,9 @@ static int at86rf230_hw_init(struct at86rf230_local *lp)
if (rc)
return rc;
 
+   irq_type = irq_get_trigger_type(lp->spi->irq);
/* configure irq polarity, defaults to high active */
-   if (pdata->irq_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW))
+   if (irq_type & (IRQF_TRIGGER_FALLING | IRQF_TRIGGER_LOW))
irq_pol = IRQ_ACTIVE_LOW;
else
irq_pol = IRQ_ACTIVE_HIGH;
@@ -1032,7 +1033,6 @@ static struct at86rf230_platform_data *
 at86rf230_get_pdata(struct spi_device *spi)
 {
struct at86rf230_platform_data *pdata;
-   const char *irq_type;
 
if (!IS_ENABLED(CONFIG_OF) || !spi->dev.of_node)
return spi->dev.platform_data;
@@ -1044,19 +1044,6 @@ at86rf230_get_pdata(struct spi_device *spi)
pdata->rstn = of_get_named_gpio(spi->dev.of_node, "reset-gpio", 0);
pdata->slp_tr = of_get_named_gpio(spi->dev.of_node, "sleep-gpio", 0);
 
-   pdata->irq_type = IRQF_TRIGGER_RISING;
-   of_property_read_string(spi->dev.of_node, "irq-type", &irq_type);
-   if (!strcmp(irq_type, "level-high"))
-   pdata->irq_type = IRQF_TRIGGER_HIGH;
-   else if (!strcmp(irq_type, "level-low"))
-   pdata->irq_type = IRQF_TRIGGER_LOW;
-   else if (!strcmp(irq_type, "edge-rising"))
-   pdata->irq_type = IRQF_TRIGGER_RISING;
-   else if (!strcmp(irq_type, "edge-falling"))
-   pdata->irq_type = IRQF_TRIGGER_FALLING;
-   else
-   dev_warn(&spi->dev, "wrong irq-type specified using 
edge-rising\n");
-
spi->dev.platform_data = pdata;
 done:
return pdata;
@@ -1071,7 +1058,7 @@ static int at86rf230_probe(struct spi_device *spi)
u8 part = 0, version = 0, status;
irq_handler_t irq_handler;
work_func_t irq_worker;
-   int rc;
+   int rc, irq_type;
const char *chip;
struct ieee802154_ops *ops = NULL;
 
@@ -1176,7 +1163,8 @@ static int at86rf230_probe(struct spi_device *spi)
dev->extra_tx_headroom = 0;
dev->flags = IEEE802154_HW_OMIT_CKSUM | IEEE802154_HW_AACK;
 
-   if (pdata->irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
+   irq_type = irq_get_trigger_type(spi->irq);
+   if (irq_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
irq_worker = at86rf230_irqwork;
irq_handler = at86rf230_isr;
} else {
@@ -1203,7 +1191,7 @@ static int at86rf230_probe(struct spi_device *spi)
goto err_hw_init;
 
rc = request_irq(spi->irq, irq_handler,
-IRQF_SHARED | pdata->irq_type,
+IRQF_SHARED | irq_type,
 dev_name(&spi->dev), lp);
if (rc)
goto err_hw_init;
diff --git a/include/linux/spi/at86rf230.h b/include/linux/spi/at86rf230.h
index aa327a8..b2b1afb 100644
--- a/include/linux/spi/at86rf230.h
+++ b/include/linux/spi/at86rf230.h
@@ -26,20 +26,6 @@ struct at86rf230_platform_data {
int rstn;
int slp_tr;
int dig2;
-
-   /* Setting the irq_type will configure the driver to request
-* the platform irq trigger type according to the given value
-* and configure the interrupt polarity of the device to the
-* corresponding polarity.
-*
-* Allowed values are: IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING,
-* IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW
-*
-* Setting it to 0, the driver does not touch the trigger type
-* configuration of the interrupt and sets the interrupt polarity
-* of the device to high active (the default value).
-*/
-   int irq_type;
 };
 
 #endif
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet

[Linux-zigbee-devel] [PATCH net-next 07/14] at86rf230: make of_device_id const

2014-04-24 Thread Alexander Aring
Signed-off-by: Alexander Aring 
---
 drivers/net/ieee802154/at86rf230.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index 46d992a..41c3384 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1216,7 +1216,7 @@ static int at86rf230_remove(struct spi_device *spi)
 }
 
 #if IS_ENABLED(CONFIG_OF)
-static struct of_device_id at86rf230_of_match[] = {
+static const struct of_device_id at86rf230_of_match[] = {
{ .compatible = "atmel,at86rf230", },
{ .compatible = "atmel,at86rf231", },
{ .compatible = "atmel,at86rf233", },
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 03/14] at86rf230: remove irq_type in request_irq

2014-04-24 Thread Alexander Aring
We don't need to set these values at request_irq. The interrupt line is
already configured to same value like irq_get_trigger_type returned.

Signed-off-by: Alexander Aring 
---
 drivers/net/ieee802154/at86rf230.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index 17b9c9a..e1d3af6 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1190,8 +1190,7 @@ static int at86rf230_probe(struct spi_device *spi)
if (rc)
goto err_hw_init;
 
-   rc = request_irq(spi->irq, irq_handler,
-IRQF_SHARED | irq_type,
+   rc = request_irq(spi->irq, irq_handler, IRQF_SHARED,
 dev_name(&spi->dev), lp);
if (rc)
goto err_hw_init;
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 12/14] at86rf230: remove unnecessary spi_set_drvdata

2014-04-24 Thread Alexander Aring
Signed-off-by: Alexander Aring 
---
 drivers/net/ieee802154/at86rf230.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index 994c334..67c01bf 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1190,7 +1190,6 @@ static int at86rf230_probe(struct spi_device *spi)
 
 err_hw_init:
flush_work(&lp->irqwork);
-   spi_set_drvdata(spi, NULL);
mutex_destroy(&lp->bmux);
ieee802154_free_device(lp->dev);
 
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 08/14] at86rf230: add at86rf230_device_id table

2014-04-24 Thread Alexander Aring
This patch adds a at86rf230_device_id table to offers various module
aliases.

Signed-off-by: Alexander Aring 
Reported-by: Varka Bhadram 
---
 drivers/net/ieee802154/at86rf230.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index 41c3384..cf376c4 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1226,7 +1226,17 @@ static const struct of_device_id at86rf230_of_match[] = {
 MODULE_DEVICE_TABLE(of, at86rf230_of_match);
 #endif
 
+static const struct spi_device_id at86rf230_device_id[] = {
+   { .name = "at86rf230", },
+   { .name = "at86rf231", },
+   { .name = "at86rf233", },
+   { .name = "at86rf212", },
+   { },
+};
+MODULE_DEVICE_TABLE(spi, at86rf230_device_id);
+
 static struct spi_driver at86rf230_driver = {
+   .id_table = at86rf230_device_id,
.driver = {
.of_match_table = of_match_ptr(at86rf230_of_match),
.name   = "at86rf230",
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 13/14] at86rf230: remove unnecessary state read

2014-04-24 Thread Alexander Aring
This patch removes a unnecessary state read. The status value is never
evaluate after reading the state.

Also rename the status variable to dvdd, because this variable will be
used later.

Signed-off-by: Alexander Aring 
---
 drivers/net/ieee802154/at86rf230.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index 67c01bf..1331152 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -969,13 +969,9 @@ static int at86rf230_irq_polarity(struct at86rf230_local 
*lp, int pol)
 static int at86rf230_hw_init(struct at86rf230_local *lp)
 {
int rc, irq_pol, irq_type;
-   u8 status;
+   u8 dvdd;
u8 csma_seed[2];
 
-   rc = at86rf230_read_subreg(lp, SR_TRX_STATUS, &status);
-   if (rc)
-   return rc;
-
rc = at86rf230_write_subreg(lp, SR_TRX_CMD, STATE_FORCE_TRX_OFF);
if (rc)
return rc;
@@ -1015,10 +1011,10 @@ static int at86rf230_hw_init(struct at86rf230_local *lp)
/* Wait the next SLEEP cycle */
msleep(100);
 
-   rc = at86rf230_read_subreg(lp, SR_DVDD_OK, &status);
+   rc = at86rf230_read_subreg(lp, SR_DVDD_OK, &dvdd);
if (rc)
return rc;
-   if (!status) {
+   if (!dvdd) {
dev_err(&lp->spi->dev, "DVDD error\n");
return -EINVAL;
}
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 09/14] at86rf230: remove #ifdef CONFIG_OF

2014-04-24 Thread Alexander Aring
This is already handled by the of_match_ptr macro.

Signed-off-by: Alexander Aring 
---
 drivers/net/ieee802154/at86rf230.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index cf376c4..b324bb3 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1215,7 +1215,6 @@ static int at86rf230_remove(struct spi_device *spi)
return 0;
 }
 
-#if IS_ENABLED(CONFIG_OF)
 static const struct of_device_id at86rf230_of_match[] = {
{ .compatible = "atmel,at86rf230", },
{ .compatible = "atmel,at86rf231", },
@@ -1224,7 +1223,6 @@ static const struct of_device_id at86rf230_of_match[] = {
{ },
 };
 MODULE_DEVICE_TABLE(of, at86rf230_of_match);
-#endif
 
 static const struct spi_device_id at86rf230_device_id[] = {
{ .name = "at86rf230", },
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 02/14] devicetree: add at86rf230 bindings

2014-04-24 Thread Alexander Aring
This patch adds devicetree bindings for the at86rf230 IEEE 802.15.4 SPI
device driver.

Signed-off-by: Alexander Aring 
---
 .../bindings/net/ieee802154/at86rf230.txt  | 23 ++
 1 file changed, 23 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/net/ieee802154/at86rf230.txt

diff --git a/Documentation/devicetree/bindings/net/ieee802154/at86rf230.txt 
b/Documentation/devicetree/bindings/net/ieee802154/at86rf230.txt
new file mode 100644
index 000..d3bbdded
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/ieee802154/at86rf230.txt
@@ -0,0 +1,23 @@
+* AT86RF230 IEEE 802.15.4 *
+
+Required properties:
+  - compatible:should be "atmel,at86rf230", "atmel,at86rf231",
+   "atmel,at86rf233" or "atmel,at86rf212"
+  - spi-max-frequency: maximal bus speed, should be set to 750 depends
+   sync or async operation mode
+  - reg:   the chipselect index
+  - interrupts:the interrupt generated by the device
+
+Optional properties:
+  - reset-gpio:GPIO spec for the rstn pin
+  - sleep-gpio:GPIO spec for the slp_tr pin
+
+Example:
+
+   at86rf231@0 {
+   compatible = "atmel,at86rf231";
+   spi-max-frequency = <750>;
+   reg = <0>;
+   interrupts = <19 1>;
+   interrupt-parent = <&gpio3>;
+   };
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 06/14] at86rf230: add missing MODULE_DEVICE_TABLE

2014-04-24 Thread Alexander Aring
Signed-off-by: Alexander Aring 
Reported-by: Varka Bhadram 
---
 drivers/net/ieee802154/at86rf230.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index d52700f..46d992a 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1223,6 +1223,7 @@ static struct of_device_id at86rf230_of_match[] = {
{ .compatible = "atmel,at86rf212", },
{ },
 };
+MODULE_DEVICE_TABLE(of, at86rf230_of_match);
 #endif
 
 static struct spi_driver at86rf230_driver = {
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 10/14] at86rf230: remove unnecessary assign

2014-04-24 Thread Alexander Aring
Signed-off-by: Alexander Aring 
---
 drivers/net/ieee802154/at86rf230.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index b324bb3..960444b 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -693,10 +693,7 @@ at86rf230_xmit(struct ieee802154_dev *dev, struct sk_buff 
*skb)
if (rc < 0)
goto err_rx;
 
-   rc = at86rf230_start(dev);
-
-   return rc;
-
+   return at86rf230_start(dev);
 err_rx:
at86rf230_start(dev);
 err:
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 05/14] at86rf230: use devm_gpio_request_one

2014-04-24 Thread Alexander Aring
This patch replace the gpio_request functions with devm_gpio_request_one
functions. Then we don't need to take care about freeing gpios.

Signed-off-by: Alexander Aring 
---
 drivers/net/ieee802154/at86rf230.c | 53 +-
 1 file changed, 12 insertions(+), 41 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index 5856488..d52700f 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1074,27 +1074,17 @@ static int at86rf230_probe(struct spi_device *spi)
}
 
if (gpio_is_valid(pdata->rstn)) {
-   rc = gpio_request(pdata->rstn, "rstn");
+   rc = devm_gpio_request_one(&spi->dev, pdata->rstn,
+  GPIOF_OUT_INIT_HIGH, "rstn");
if (rc)
return rc;
}
 
if (gpio_is_valid(pdata->slp_tr)) {
-   rc = gpio_request(pdata->slp_tr, "slp_tr");
+   rc = devm_gpio_request_one(&spi->dev, pdata->slp_tr,
+  GPIOF_OUT_INIT_LOW, "slp_tr");
if (rc)
-   goto err_slp_tr;
-   }
-
-   if (gpio_is_valid(pdata->rstn)) {
-   rc = gpio_direction_output(pdata->rstn, 1);
-   if (rc)
-   goto err_gpio_dir;
-   }
-
-   if (gpio_is_valid(pdata->slp_tr)) {
-   rc = gpio_direction_output(pdata->slp_tr, 0);
-   if (rc)
-   goto err_gpio_dir;
+   return rc;
}
 
/* Reset */
@@ -1108,13 +1098,12 @@ static int at86rf230_probe(struct spi_device *spi)
 
rc = __at86rf230_detect_device(spi, &man_id, &part, &version);
if (rc < 0)
-   goto err_gpio_dir;
+   return rc;
 
if (man_id != 0x001f) {
dev_err(&spi->dev, "Non-Atmel dev found (MAN_ID %02x %02x)\n",
man_id >> 8, man_id & 0xFF);
-   rc = -EINVAL;
-   goto err_gpio_dir;
+   return -EINVAL;
}
 
switch (part) {
@@ -1141,16 +1130,12 @@ static int at86rf230_probe(struct spi_device *spi)
}
 
dev_info(&spi->dev, "Detected %s chip version %d\n", chip, version);
-   if (!ops) {
-   rc = -ENOTSUPP;
-   goto err_gpio_dir;
-   }
+   if (!ops)
+   return -ENOTSUPP;
 
dev = ieee802154_alloc_device(sizeof(*lp), ops);
-   if (!dev) {
-   rc = -ENOMEM;
-   goto err_gpio_dir;
-   }
+   if (!dev)
+   return -ENOMEM;
 
lp = dev->priv;
lp->dev = dev;
@@ -1212,35 +1197,21 @@ err_hw_init:
mutex_destroy(&lp->bmux);
ieee802154_free_device(lp->dev);
 
-err_gpio_dir:
-   if (gpio_is_valid(pdata->slp_tr))
-   gpio_free(pdata->slp_tr);
-err_slp_tr:
-   if (gpio_is_valid(pdata->rstn))
-   gpio_free(pdata->rstn);
return rc;
 }
 
 static int at86rf230_remove(struct spi_device *spi)
 {
struct at86rf230_local *lp = spi_get_drvdata(spi);
-   struct at86rf230_platform_data *pdata = spi->dev.platform_data;
 
/* mask all at86rf230 irq's */
at86rf230_write_subreg(lp, SR_IRQ_MASK, 0);
ieee802154_unregister_device(lp->dev);
-
flush_work(&lp->irqwork);
-
-   if (gpio_is_valid(pdata->slp_tr))
-   gpio_free(pdata->slp_tr);
-   if (gpio_is_valid(pdata->rstn))
-   gpio_free(pdata->rstn);
-
mutex_destroy(&lp->bmux);
ieee802154_free_device(lp->dev);
-
dev_dbg(&spi->dev, "unregistered at86rf230\n");
+
return 0;
 }
 
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 04/14] at86rf230: use devm_request_irq

2014-04-24 Thread Alexander Aring
This patch replace request_irq with devm_request_irq. With
devm_request_irq we don't need to care about freeing the irq.

Signed-off-by: Alexander Aring 
---
 drivers/net/ieee802154/at86rf230.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index e1d3af6..5856488 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1190,24 +1190,22 @@ static int at86rf230_probe(struct spi_device *spi)
if (rc)
goto err_hw_init;
 
-   rc = request_irq(spi->irq, irq_handler, IRQF_SHARED,
-dev_name(&spi->dev), lp);
+   rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, IRQF_SHARED,
+ dev_name(&spi->dev), lp);
if (rc)
goto err_hw_init;
 
/* Read irq status register to reset irq line */
rc = at86rf230_read_subreg(lp, RG_IRQ_STATUS, 0xff, 0, &status);
if (rc)
-   goto err_irq;
+   goto err_hw_init;
 
rc = ieee802154_register_device(lp->dev);
if (rc)
-   goto err_irq;
+   goto err_hw_init;
 
return rc;
 
-err_irq:
-   free_irq(spi->irq, lp);
 err_hw_init:
flush_work(&lp->irqwork);
spi_set_drvdata(spi, NULL);
@@ -1232,7 +1230,6 @@ static int at86rf230_remove(struct spi_device *spi)
at86rf230_write_subreg(lp, SR_IRQ_MASK, 0);
ieee802154_unregister_device(lp->dev);
 
-   free_irq(spi->irq, lp);
flush_work(&lp->irqwork);
 
if (gpio_is_valid(pdata->slp_tr))
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 11/14] at86rf230: reset irq line before irq request

2014-04-24 Thread Alexander Aring
This patch resets the irq line before we are requesting the irq. This
avoids pending interrupts before requesting.

Signed-off-by: Alexander Aring 
---
 drivers/net/ieee802154/at86rf230.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index 960444b..994c334 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1172,13 +1172,13 @@ static int at86rf230_probe(struct spi_device *spi)
if (rc)
goto err_hw_init;
 
-   rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, IRQF_SHARED,
- dev_name(&spi->dev), lp);
+   /* Read irq status register to reset irq line */
+   rc = at86rf230_read_subreg(lp, RG_IRQ_STATUS, 0xff, 0, &status);
if (rc)
goto err_hw_init;
 
-   /* Read irq status register to reset irq line */
-   rc = at86rf230_read_subreg(lp, RG_IRQ_STATUS, 0xff, 0, &status);
+   rc = devm_request_irq(&spi->dev, spi->irq, irq_handler, IRQF_SHARED,
+ dev_name(&spi->dev), lp);
if (rc)
goto err_hw_init;
 
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


[Linux-zigbee-devel] [PATCH net-next 14/14] at86rf230: remove function for setting irq polarity

2014-04-24 Thread Alexander Aring
The function is small enough, we don't need a extra function for this.

Signed-off-by: Alexander Aring 
---
 drivers/net/ieee802154/at86rf230.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c 
b/drivers/net/ieee802154/at86rf230.c
index 1331152..4517b14 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -961,11 +961,6 @@ static irqreturn_t at86rf230_isr_level(int irq, void *data)
return at86rf230_isr(irq, data);
 }
 
-static int at86rf230_irq_polarity(struct at86rf230_local *lp, int pol)
-{
-   return at86rf230_write_subreg(lp, SR_IRQ_POLARITY, pol);
-}
-
 static int at86rf230_hw_init(struct at86rf230_local *lp)
 {
int rc, irq_pol, irq_type;
@@ -983,7 +978,7 @@ static int at86rf230_hw_init(struct at86rf230_local *lp)
else
irq_pol = IRQ_ACTIVE_HIGH;
 
-   rc = at86rf230_irq_polarity(lp, irq_pol);
+   rc = at86rf230_write_subreg(lp, SR_IRQ_POLARITY, irq_pol);
if (rc)
return rc;
 
-- 
1.9.2


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


Re: [Linux-zigbee-devel] [PATCH] 6lowpan: nuke net_ieee802154_lowpan() accessor when 6lowpan is disabled

2014-04-24 Thread Luis R. Rodriguez
On Thu, Apr 24, 2014 at 9:44 AM, Alexander Aring  wrote:
> Hi,
>
> On Tue, Apr 22, 2014 at 12:03:58PM -0700, Luis R. Rodriguez wrote:
>> From: "Luis R. Rodriguez" 
>>
>> Johannes noted this is not needed, all of the fragment
>> accessors don't need CONFIG_NET_NS. This goes test compiled with
>> CONFIG_BT_6LOWPAN=y and a disabled CONFIG_NET_NS.
>>
>
> a little note about this here. There exists two 6LoWPAN standard. One
> for bluetooth low energy and one for IEEE 802.15.4.
>
> The actual namespace is only for IEEE 802.15.4, because we need
> fragmentation there. 6LoWPAN fragmentation for bluetooth low energy is
> already handled by the MAC-Layer. So this has nothing to do with
> CONFIG_BT_6LOWPAN.

Thanks for the clarification, I actually did mean
CONFIG_IEEE802154_6LOWPAN however, I goofed that on the commit log.

  Luis

--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


Re: [Linux-zigbee-devel] [PATCH] 6lowpan: nuke net_ieee802154_lowpan() accessor when 6lowpan is disabled

2014-04-24 Thread Alexander Aring
Hi Luis,

On Thu, Apr 24, 2014 at 10:25:58AM -0700, Luis R. Rodriguez wrote:
> On Thu, Apr 24, 2014 at 9:44 AM, Alexander Aring  wrote:
> > Hi,
> >
> > On Tue, Apr 22, 2014 at 12:03:58PM -0700, Luis R. Rodriguez wrote:
> >> From: "Luis R. Rodriguez" 
> >>
> >> Johannes noted this is not needed, all of the fragment
> >> accessors don't need CONFIG_NET_NS. This goes test compiled with
> >> CONFIG_BT_6LOWPAN=y and a disabled CONFIG_NET_NS.
> >>
> >
> > a little note about this here. There exists two 6LoWPAN standard. One
> > for bluetooth low energy and one for IEEE 802.15.4.
> >
> > The actual namespace is only for IEEE 802.15.4, because we need
> > fragmentation there. 6LoWPAN fragmentation for bluetooth low energy is
> > already handled by the MAC-Layer. So this has nothing to do with
> > CONFIG_BT_6LOWPAN.
> 
> Thanks for the clarification, I actually did mean
> CONFIG_IEEE802154_6LOWPAN however, I goofed that on the commit log.
> 

ok. But I need to say thanks for sending this patch! :-)

It's nice to see that the community helps to improving the code which I
produced and it's really not perfect at the moment. (I was a little bit
shocked that somebody makes the effort to making a backport about that).

- Alex

--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel


Re: [Linux-zigbee-devel] [PATCH] 6lowpan: nuke net_ieee802154_lowpan() accessor when 6lowpan is disabled

2014-04-24 Thread Luis R. Rodriguez
On Thu, Apr 24, 2014 at 10:33 AM, Alexander Aring  wrote:
> Hi Luis,
>
> On Thu, Apr 24, 2014 at 10:25:58AM -0700, Luis R. Rodriguez wrote:
>> On Thu, Apr 24, 2014 at 9:44 AM, Alexander Aring  
>> wrote:
>> > Hi,
>> >
>> > On Tue, Apr 22, 2014 at 12:03:58PM -0700, Luis R. Rodriguez wrote:
>> >> From: "Luis R. Rodriguez" 
>> >>
>> >> Johannes noted this is not needed, all of the fragment
>> >> accessors don't need CONFIG_NET_NS. This goes test compiled with
>> >> CONFIG_BT_6LOWPAN=y and a disabled CONFIG_NET_NS.
>> >>
>> >
>> > a little note about this here. There exists two 6LoWPAN standard. One
>> > for bluetooth low energy and one for IEEE 802.15.4.
>> >
>> > The actual namespace is only for IEEE 802.15.4, because we need
>> > fragmentation there. 6LoWPAN fragmentation for bluetooth low energy is
>> > already handled by the MAC-Layer. So this has nothing to do with
>> > CONFIG_BT_6LOWPAN.
>>
>> Thanks for the clarification, I actually did mean
>> CONFIG_IEEE802154_6LOWPAN however, I goofed that on the commit log.
>>
>
> ok. But I need to say thanks for sending this patch! :-)
>
> It's nice to see that the community helps to improving the code which I
> produced and it's really not perfect at the moment. (I was a little bit
> shocked that somebody makes the effort to making a backport about that).

To be clear -- we strive for automatic backport for the entire Linux
kernel, so the way this should be seen is that if something gets added
to Linux it will eventually get backported automatically. We're not
there yet to scale rapid integration of most used drivers but that is
a lofty objective. In this case what triggered the backport was that
Hauke orginally had added backport support for CONFIG_IEEE802154, when
6 Lowpan was merged upstream we took that in as well, that required a
few changes to help with the automatic backport, and I'm glad these
have gone in now. I should also note that I haven't personally tested
the 6lowpan backport but reports from users on the backport with
IEEE802154 or 6lowpan would be greatly appreciated, typically for
backports the way it works is if things compile it should work as the
backports code only consists of about 1% of the code used and bugs
have been infrequent on that codebase. Since 6lowpan is ever changing,
as noted in earlier threads, folks can use the latest linux-next based
backports release, this is listed on the temporary backports release
page [0].

[0] http://drvbp1.linux-foundation.org/~mcgrof/rel-html/backports/

  Luis

--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel