| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ISA Plug & Play support |
|---|
| 3 | 4 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
|---|
| 4 | | - * |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | | - * (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License |
|---|
| 17 | | - * along with this program; if not, write to the Free Software |
|---|
| 18 | | - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 19 | 5 | * |
|---|
| 20 | 6 | * Changelog: |
|---|
| 21 | 7 | * 2000-01-01 Added quirks handling for buggy hardware |
|---|
| .. | .. |
|---|
| 761 | 747 | } |
|---|
| 762 | 748 | |
|---|
| 763 | 749 | /* |
|---|
| 764 | | - * Compute ISA PnP checksum for first eight bytes. |
|---|
| 765 | | - */ |
|---|
| 766 | | -static unsigned char __init isapnp_checksum(unsigned char *data) |
|---|
| 767 | | -{ |
|---|
| 768 | | - int i, j; |
|---|
| 769 | | - unsigned char checksum = 0x6a, bit, b; |
|---|
| 770 | | - |
|---|
| 771 | | - for (i = 0; i < 8; i++) { |
|---|
| 772 | | - b = data[i]; |
|---|
| 773 | | - for (j = 0; j < 8; j++) { |
|---|
| 774 | | - bit = 0; |
|---|
| 775 | | - if (b & (1 << j)) |
|---|
| 776 | | - bit = 1; |
|---|
| 777 | | - checksum = |
|---|
| 778 | | - ((((checksum ^ (checksum >> 1)) & 0x01) ^ bit) << 7) |
|---|
| 779 | | - | (checksum >> 1); |
|---|
| 780 | | - } |
|---|
| 781 | | - } |
|---|
| 782 | | - return checksum; |
|---|
| 783 | | -} |
|---|
| 784 | | - |
|---|
| 785 | | -/* |
|---|
| 786 | 750 | * Build device list for all present ISA PnP devices. |
|---|
| 787 | 751 | */ |
|---|
| 788 | 752 | static int __init isapnp_build_device_list(void) |
|---|
| 789 | 753 | { |
|---|
| 790 | 754 | int csn; |
|---|
| 791 | | - unsigned char header[9], checksum; |
|---|
| 755 | + unsigned char header[9]; |
|---|
| 792 | 756 | struct pnp_card *card; |
|---|
| 793 | 757 | u32 eisa_id; |
|---|
| 794 | 758 | char id[8]; |
|---|
| .. | .. |
|---|
| 798 | 762 | for (csn = 1; csn <= isapnp_csn_count; csn++) { |
|---|
| 799 | 763 | isapnp_wake(csn); |
|---|
| 800 | 764 | isapnp_peek(header, 9); |
|---|
| 801 | | - checksum = isapnp_checksum(header); |
|---|
| 802 | 765 | eisa_id = header[0] | header[1] << 8 | |
|---|
| 803 | 766 | header[2] << 16 | header[3] << 24; |
|---|
| 804 | 767 | pnp_eisa_id_to_string(eisa_id, id); |
|---|