Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions drivers/jtag/jtag-aspeed.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,14 +548,20 @@ static int aspeed_jtag_isr_wait(struct aspeed_jtag *aspeed_jtag, u32 bit)

static int aspeed_jtag_wait_shift_complete(struct aspeed_jtag *aspeed_jtag)
{
long Lres = 0;
int res = 0;
u32 status = 0;
u32 iterations = 0;

if (!aspeed_jtag->irq) {
res = wait_event_interruptible(aspeed_jtag->jtag_wq,
aspeed_jtag->flag &
ASPEED_JTAG_INTCTRL_SHCPL_IRQ_STAT);
Lres = wait_event_interruptible_timeout(aspeed_jtag->jtag_wq,
aspeed_jtag->flag &
ASPEED_JTAG_INTCTRL_SHCPL_IRQ_STAT,
(long)msecs_to_jiffies(1000));
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check if this work - is long required - msecs_to_jiffies(1000);

if (Lres == 0) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add
if (Lres < 0)
return Lres;

dev_err(aspeed_jtag->dev,
"aspeed_jtag_wait_shift_complete: timeout after 1 sec \n");
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add - return -ETIMEDOUT;

aspeed_jtag->flag &= ~ASPEED_JTAG_INTCTRL_SHCPL_IRQ_STAT;
} else {
while ((status & ASPEED_JTAG_INTCTRL_SHCPL_IRQ_STAT) == 0) {
Expand Down