Hello,

Sorry for ignoring this patch for sooo loooong. A bit better (IMHO)
patch was commited recently by Alexander/updated by me, which just
handles this few commands in a special
way.

On 3/30/11, Werner Almesberger <wer...@almesberger.net> wrote:
> at86rf230_state expects the number of the final state to be equal to
> the number of the state change command. This is not true for commands
> that force a state change, such as STATE_FORCE_TRX_OFF and
> STATE_FORCE_TX_ON.
>
> at86rf230_state would thus erroneously return an error, which caused
> at86rf230_xmit to exit before sending the frame.
>
> This patch separates the state change command passed to at86rf230_state
> from the final state.
>
> - at86rf230.c (at86rf230_state): separate state change command and final
>   state, since not all commands lead to a state with the same number
> - at86rf230.c (at86rf230_start, at86rf230_stop, at86rf230_xmit): updated
>   for new use of at86rf230_state
>
> Signed-off-by: Werner Almesberger <wer...@almesberger.net>
>
> ---
>  drivers/ieee802154/at86rf230.c |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/ieee802154/at86rf230.c b/drivers/ieee802154/at86rf230.c
> index 5c01561..ad7e432 100644
> --- a/drivers/ieee802154/at86rf230.c
> +++ b/drivers/ieee802154/at86rf230.c
> @@ -440,7 +440,7 @@ at86rf230_ed(struct ieee802154_dev *dev, u8 *level)
>  }
>
>  static int
> -at86rf230_state(struct ieee802154_dev *dev, int state)
> +at86rf230_state(struct ieee802154_dev *dev, int cmd, int state)
>  {
>       struct at86rf230_local *lp = dev->priv;
>       int rc;
> @@ -459,8 +459,8 @@ at86rf230_state(struct ieee802154_dev *dev, int state)
>       if (val == state)
>               return 0;
>
> -     /* state is equal to phy states */
> -     rc = at86rf230_write_subreg(lp, SR_TRX_CMD, state);
> +     /* state is equal to phy states, except for "forced" transitions  */
> +     rc = at86rf230_write_subreg(lp, SR_TRX_CMD, cmd);
>       if (rc)
>               goto err;
>
> @@ -484,13 +484,13 @@ err:
>  static int
>  at86rf230_start(struct ieee802154_dev *dev)
>  {
> -     return at86rf230_state(dev, STATE_RX_ON);
> +     return at86rf230_state(dev, STATE_RX_ON, STATE_RX_ON);
>  }
>
>  static void
>  at86rf230_stop(struct ieee802154_dev *dev)
>  {
> -     at86rf230_state(dev, STATE_FORCE_TRX_OFF);
> +     at86rf230_state(dev, STATE_FORCE_TRX_OFF, STATE_TRX_OFF);
>  }
>
>  static int
> @@ -530,7 +530,7 @@ at86rf230_xmit(struct ieee802154_dev *dev, struct
> sk_buff *skb)
>       INIT_COMPLETION(lp->tx_complete);
>       spin_unlock_irqrestore(&lp->lock, flags);
>
> -     rc = at86rf230_state(dev, STATE_FORCE_TX_ON);
> +     rc = at86rf230_state(dev, STATE_FORCE_TX_ON, STATE_TX_ON);
>       if (rc)
>               goto err;
>
> @@ -552,12 +552,12 @@ at86rf230_xmit(struct ieee802154_dev *dev, struct
> sk_buff *skb)
>       if (rc < 0)
>               goto err_rx;
>
> -     rc = at86rf230_state(dev, STATE_RX_ON);
> +     rc = at86rf230_state(dev, STATE_RX_ON, STATE_RX_ON);
>
>       return rc;
>
>  err_rx:
> -     at86rf230_state(dev, STATE_RX_ON);
> +     at86rf230_state(dev, STATE_RX_ON, STATE_RX_ON);
>  err:
>       spin_lock_irqsave(&lp->lock, flags);
>       lp->is_tx = 0;
> --
> 1.7.0.4
>
>
> ------------------------------------------------------------------------------
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software
> be a part of the solution? Download the Intel(R) Manageability Checker
> today! http://p.sf.net/sfu/intel-dev2devmar
> _______________________________________________
> Linux-zigbee-devel mailing list
> Linux-zigbee-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel
>


-- 
With best wishes
Dmitry

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to