| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* sb1000.c: A General Instruments SB1000 driver for linux. */ |
|---|
| 2 | 3 | /* |
|---|
| 3 | 4 | Written 1998 by Franco Venturi. |
|---|
| .. | .. |
|---|
| 11 | 12 | |
|---|
| 12 | 13 | The author may be reached as fventuri@mediaone.net |
|---|
| 13 | 14 | |
|---|
| 14 | | - This program is free software; you can redistribute it |
|---|
| 15 | | - and/or modify it under the terms of the GNU General |
|---|
| 16 | | - Public License as published by the Free Software |
|---|
| 17 | | - Foundation; either version 2 of the License, or (at |
|---|
| 18 | | - your option) any later version. |
|---|
| 19 | 15 | |
|---|
| 20 | 16 | Changes: |
|---|
| 21 | 17 | |
|---|
| .. | .. |
|---|
| 316 | 312 | card_send_command(const int ioaddr[], const char* name, |
|---|
| 317 | 313 | const unsigned char out[], unsigned char in[]) |
|---|
| 318 | 314 | { |
|---|
| 319 | | - int status, x; |
|---|
| 315 | + int status; |
|---|
| 320 | 316 | |
|---|
| 321 | 317 | if ((status = card_wait_for_busy_clear(ioaddr, name))) |
|---|
| 322 | 318 | return status; |
|---|
| .. | .. |
|---|
| 345 | 341 | out[0], out[1], out[2], out[3], out[4], out[5]); |
|---|
| 346 | 342 | } |
|---|
| 347 | 343 | |
|---|
| 348 | | - if (out[1] == 0x1b) { |
|---|
| 349 | | - x = (out[2] == 0x02); |
|---|
| 350 | | - } else { |
|---|
| 344 | + if (out[1] != 0x1b) { |
|---|
| 351 | 345 | if (out[0] >= 0x80 && in[0] != (out[1] | 0x80)) |
|---|
| 352 | 346 | return -EIO; |
|---|
| 353 | 347 | } |
|---|
| .. | .. |
|---|
| 490 | 484 | static const unsigned char Command0[6] = {0x80, 0x1f, 0x00, 0x00, 0x00, 0x00}; |
|---|
| 491 | 485 | |
|---|
| 492 | 486 | unsigned char st[7]; |
|---|
| 493 | | - int crc, status; |
|---|
| 487 | + int status; |
|---|
| 494 | 488 | |
|---|
| 495 | 489 | /* check CRC */ |
|---|
| 496 | 490 | if ((status = card_send_command(ioaddr, name, Command0, st))) |
|---|
| 497 | 491 | return status; |
|---|
| 498 | 492 | if (st[1] != st[3] || st[2] != st[4]) |
|---|
| 499 | 493 | return -EIO; |
|---|
| 500 | | - crc = st[1] << 8 | st[2]; |
|---|
| 501 | 494 | return 0; |
|---|
| 502 | 495 | } |
|---|
| 503 | 496 | |
|---|
| .. | .. |
|---|
| 535 | 528 | int status; |
|---|
| 536 | 529 | |
|---|
| 537 | 530 | ssleep(1); |
|---|
| 538 | | - if ((status = card_send_command(ioaddr, name, Command0, st))) |
|---|
| 531 | + status = card_send_command(ioaddr, name, Command0, st); |
|---|
| 532 | + if (status) |
|---|
| 539 | 533 | return status; |
|---|
| 540 | | - if ((status = card_send_command(ioaddr, name, Command1, st))) |
|---|
| 534 | + status = card_send_command(ioaddr, name, Command1, st); |
|---|
| 535 | + if (status) |
|---|
| 541 | 536 | return status; |
|---|
| 542 | 537 | if (st[3] != 0xf1) { |
|---|
| 543 | | - if ((status = sb1000_start_get_set_command(ioaddr, name))) |
|---|
| 538 | + status = sb1000_start_get_set_command(ioaddr, name); |
|---|
| 539 | + if (status) |
|---|
| 544 | 540 | return status; |
|---|
| 545 | 541 | return -EIO; |
|---|
| 546 | 542 | } |
|---|
| 547 | 543 | udelay(1000); |
|---|
| 548 | | - return sb1000_start_get_set_command(ioaddr, name); |
|---|
| 544 | + return sb1000_start_get_set_command(ioaddr, name); |
|---|
| 549 | 545 | } |
|---|
| 550 | 546 | |
|---|
| 551 | 547 | /* get SB1000 firmware version */ |
|---|