diff options
author | Alexander Aring <alex.aring@gmail.com> | 2015-03-01 15:55:32 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-03-02 20:15:25 -0500 |
commit | 31fa74344c1e75fd66f7b43f456ae9e0a137ba69 (patch) | |
tree | 9121d3fe566b5116b514a436f408a0bd61fa36fc /drivers/net/ieee802154 | |
parent | cca990c85d37a9ed42d2cac53c619abec7faa12f (diff) |
at86rf230: remove multiple dereferencing for ctx
This patch cleanups the referencing for the state change context
variable. The state change context should only set once and this is by
initial a state change. This patch will use the initial state change
variable in the complete handler of the state change by using the ctx
context which should be always the same like the initial state change
context.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/net/ieee802154')
-rw-r--r-- | drivers/net/ieee802154/at86rf230.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 7f27fa35bde3..216c80c3532c 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c | |||
@@ -738,7 +738,7 @@ at86rf230_tx_on(void *context) | |||
738 | struct at86rf230_state_change *ctx = context; | 738 | struct at86rf230_state_change *ctx = context; |
739 | struct at86rf230_local *lp = ctx->lp; | 739 | struct at86rf230_local *lp = ctx->lp; |
740 | 740 | ||
741 | at86rf230_async_state_change(lp, &lp->irq, STATE_RX_AACK_ON, | 741 | at86rf230_async_state_change(lp, ctx, STATE_RX_AACK_ON, |
742 | at86rf230_tx_complete, true); | 742 | at86rf230_tx_complete, true); |
743 | } | 743 | } |
744 | 744 | ||
@@ -787,7 +787,7 @@ at86rf230_rx_read_frame_complete(void *context) | |||
787 | struct at86rf230_state_change *ctx = context; | 787 | struct at86rf230_state_change *ctx = context; |
788 | struct at86rf230_local *lp = ctx->lp; | 788 | struct at86rf230_local *lp = ctx->lp; |
789 | u8 rx_local_buf[AT86RF2XX_MAX_BUF]; | 789 | u8 rx_local_buf[AT86RF2XX_MAX_BUF]; |
790 | const u8 *buf = lp->irq.buf; | 790 | const u8 *buf = ctx->buf; |
791 | struct sk_buff *skb; | 791 | struct sk_buff *skb; |
792 | u8 len, lqi; | 792 | u8 len, lqi; |
793 | 793 | ||
@@ -816,17 +816,16 @@ at86rf230_rx_read_frame(void *context) | |||
816 | { | 816 | { |
817 | struct at86rf230_state_change *ctx = context; | 817 | struct at86rf230_state_change *ctx = context; |
818 | struct at86rf230_local *lp = ctx->lp; | 818 | struct at86rf230_local *lp = ctx->lp; |
819 | u8 *buf = ctx->buf; | ||
819 | int rc; | 820 | int rc; |
820 | 821 | ||
821 | u8 *buf = lp->irq.buf; | ||
822 | |||
823 | buf[0] = CMD_FB; | 822 | buf[0] = CMD_FB; |
824 | lp->irq.trx.len = AT86RF2XX_MAX_BUF; | 823 | ctx->trx.len = AT86RF2XX_MAX_BUF; |
825 | lp->irq.msg.complete = at86rf230_rx_read_frame_complete; | 824 | ctx->msg.complete = at86rf230_rx_read_frame_complete; |
826 | rc = spi_async(lp->spi, &lp->irq.msg); | 825 | rc = spi_async(lp->spi, &ctx->msg); |
827 | if (rc) { | 826 | if (rc) { |
828 | enable_irq(ctx->irq); | 827 | enable_irq(ctx->irq); |
829 | at86rf230_async_error(lp, &lp->irq, rc); | 828 | at86rf230_async_error(lp, ctx, rc); |
830 | } | 829 | } |
831 | } | 830 | } |
832 | 831 | ||
@@ -872,7 +871,7 @@ at86rf230_irq_status(void *context) | |||
872 | { | 871 | { |
873 | struct at86rf230_state_change *ctx = context; | 872 | struct at86rf230_state_change *ctx = context; |
874 | struct at86rf230_local *lp = ctx->lp; | 873 | struct at86rf230_local *lp = ctx->lp; |
875 | const u8 *buf = lp->irq.buf; | 874 | const u8 *buf = ctx->buf; |
876 | const u8 irq = buf[1]; | 875 | const u8 irq = buf[1]; |
877 | 876 | ||
878 | if (irq & IRQ_TRX_END) { | 877 | if (irq & IRQ_TRX_END) { |
@@ -929,7 +928,7 @@ at86rf230_write_frame(void *context) | |||
929 | struct at86rf230_state_change *ctx = context; | 928 | struct at86rf230_state_change *ctx = context; |
930 | struct at86rf230_local *lp = ctx->lp; | 929 | struct at86rf230_local *lp = ctx->lp; |
931 | struct sk_buff *skb = lp->tx_skb; | 930 | struct sk_buff *skb = lp->tx_skb; |
932 | u8 *buf = lp->tx.buf; | 931 | u8 *buf = ctx->buf; |
933 | int rc; | 932 | int rc; |
934 | 933 | ||
935 | spin_lock(&lp->lock); | 934 | spin_lock(&lp->lock); |
@@ -939,9 +938,9 @@ at86rf230_write_frame(void *context) | |||
939 | buf[0] = CMD_FB | CMD_WRITE; | 938 | buf[0] = CMD_FB | CMD_WRITE; |
940 | buf[1] = skb->len + 2; | 939 | buf[1] = skb->len + 2; |
941 | memcpy(buf + 2, skb->data, skb->len); | 940 | memcpy(buf + 2, skb->data, skb->len); |
942 | lp->tx.trx.len = skb->len + 2; | 941 | ctx->trx.len = skb->len + 2; |
943 | lp->tx.msg.complete = at86rf230_write_frame_complete; | 942 | ctx->msg.complete = at86rf230_write_frame_complete; |
944 | rc = spi_async(lp->spi, &lp->tx.msg); | 943 | rc = spi_async(lp->spi, &ctx->msg); |
945 | if (rc) | 944 | if (rc) |
946 | at86rf230_async_error(lp, ctx, rc); | 945 | at86rf230_async_error(lp, ctx, rc); |
947 | } | 946 | } |