Message ID | 20201009040001.310868-9-amitay@ozlabs.org |
---|---|
State | Accepted |
Headers | show |
Series | Fix thread status for sbefifo thread driver | expand |
On Fri, 9 Oct 2020 at 04:00, Amitay Isaacs <amitay@ozlabs.org> wrote: > > Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> > --- > libpdbg/sbefifo.c | 36 +++++++++++++++++++++++++++++++++--- > 1 file changed, 33 insertions(+), 3 deletions(-) > > diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c > index fae2ab7..a8e4522 100644 > --- a/libpdbg/sbefifo.c > +++ b/libpdbg/sbefifo.c > @@ -263,12 +263,32 @@ static int sbefifo_pib_thread_op(struct pib *pib, uint32_t oper) > > static int sbefifo_pib_thread_start(struct pib *pib) > { > - return sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_START); > + struct pdbg_target *target; > + int rc; > + > + rc = sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_START); > + > + pdbg_for_each_target("thread", &pib->target, target) { > + struct thread *thread = target_to_thread(target); > + thread->status = thread->state(thread); > + } You could have a update_thread_state(struct pib *pib) to save duplicating this three times. Either way, Reviewed-by: Joel Stanley <joel@jms.id.au> > + > + return rc; > } > > static int sbefifo_pib_thread_stop(struct pib *pib) > { > - return sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_STOP); > + struct pdbg_target *target; > + int rc; > + > + rc = sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_STOP); > + > + pdbg_for_each_target("thread", &pib->target, target) { > + struct thread *thread = target_to_thread(target); > + thread->status = thread->state(thread); > + } > + > + return rc; > } > > static int sbefifo_pib_thread_step(struct pib *pib, int count) > @@ -283,7 +303,17 @@ static int sbefifo_pib_thread_step(struct pib *pib, int count) > > static int sbefifo_pib_thread_sreset(struct pib *pib) > { > - return sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_SRESET); > + struct pdbg_target *target; > + int rc; > + > + rc = sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_SRESET); > + > + pdbg_for_each_target("thread", &pib->target, target) { > + struct thread *thread = target_to_thread(target); > + thread->status = thread->state(thread); > + } > + > + return rc; > } > > static int sbefifo_thread_probe(struct pdbg_target *target) > -- > 2.26.2 > > -- > Pdbg mailing list > Pdbg@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/pdbg
On Fri, 2020-10-09 at 12:47 +0000, Joel Stanley wrote: > On Fri, 9 Oct 2020 at 04:00, Amitay Isaacs <amitay@ozlabs.org> wrote: > > Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> > > --- > > libpdbg/sbefifo.c | 36 +++++++++++++++++++++++++++++++++--- > > 1 file changed, 33 insertions(+), 3 deletions(-) > > > > diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c > > index fae2ab7..a8e4522 100644 > > --- a/libpdbg/sbefifo.c > > +++ b/libpdbg/sbefifo.c > > @@ -263,12 +263,32 @@ static int sbefifo_pib_thread_op(struct pib > > *pib, uint32_t oper) > > > > static int sbefifo_pib_thread_start(struct pib *pib) > > { > > - return sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_START); > > + struct pdbg_target *target; > > + int rc; > > + > > + rc = sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_START); > > + > > + pdbg_for_each_target("thread", &pib->target, target) { > > + struct thread *thread = target_to_thread(target); > > + thread->status = thread->state(thread); > > + } > > You could have a update_thread_state(struct pib *pib) to save > duplicating this three times. Good point. :-) > > Either way, > > Reviewed-by: Joel Stanley <joel@jms.id.au> > Amitay.
diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index fae2ab7..a8e4522 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -263,12 +263,32 @@ static int sbefifo_pib_thread_op(struct pib *pib, uint32_t oper) static int sbefifo_pib_thread_start(struct pib *pib) { - return sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_START); + struct pdbg_target *target; + int rc; + + rc = sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_START); + + pdbg_for_each_target("thread", &pib->target, target) { + struct thread *thread = target_to_thread(target); + thread->status = thread->state(thread); + } + + return rc; } static int sbefifo_pib_thread_stop(struct pib *pib) { - return sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_STOP); + struct pdbg_target *target; + int rc; + + rc = sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_STOP); + + pdbg_for_each_target("thread", &pib->target, target) { + struct thread *thread = target_to_thread(target); + thread->status = thread->state(thread); + } + + return rc; } static int sbefifo_pib_thread_step(struct pib *pib, int count) @@ -283,7 +303,17 @@ static int sbefifo_pib_thread_step(struct pib *pib, int count) static int sbefifo_pib_thread_sreset(struct pib *pib) { - return sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_SRESET); + struct pdbg_target *target; + int rc; + + rc = sbefifo_pib_thread_op(pib, SBEFIFO_INSN_OP_SRESET); + + pdbg_for_each_target("thread", &pib->target, target) { + struct thread *thread = target_to_thread(target); + thread->status = thread->state(thread); + } + + return rc; } static int sbefifo_thread_probe(struct pdbg_target *target)
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- libpdbg/sbefifo.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-)