| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * linux/drivers/mmc/core/sdio_cis.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Copyright: MontaVista Software Inc. |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * Copyright 2007 Pierre Ossman |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 12 | | - * the Free Software Foundation; either version 2 of the License, or (at |
|---|
| 13 | | - * your option) any later version. |
|---|
| 14 | 10 | */ |
|---|
| 15 | 11 | |
|---|
| 16 | 12 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 29 | 25 | static int cistpl_vers_1(struct mmc_card *card, struct sdio_func *func, |
|---|
| 30 | 26 | const unsigned char *buf, unsigned size) |
|---|
| 31 | 27 | { |
|---|
| 28 | + u8 major_rev, minor_rev; |
|---|
| 32 | 29 | unsigned i, nr_strings; |
|---|
| 33 | 30 | char **buffer, *string; |
|---|
| 34 | 31 | |
|---|
| 35 | 32 | if (size < 2) |
|---|
| 36 | 33 | return 0; |
|---|
| 34 | + |
|---|
| 35 | + major_rev = buf[0]; |
|---|
| 36 | + minor_rev = buf[1]; |
|---|
| 37 | 37 | |
|---|
| 38 | 38 | /* Find all null-terminated (including zero length) strings in |
|---|
| 39 | 39 | the TPLLV1_INFO field. Trailing garbage is ignored. */ |
|---|
| .. | .. |
|---|
| 66 | 66 | } |
|---|
| 67 | 67 | |
|---|
| 68 | 68 | if (func) { |
|---|
| 69 | + func->major_rev = major_rev; |
|---|
| 70 | + func->minor_rev = minor_rev; |
|---|
| 69 | 71 | func->num_info = nr_strings; |
|---|
| 70 | 72 | func->info = (const char**)buffer; |
|---|
| 71 | 73 | } else { |
|---|
| 74 | + card->major_rev = major_rev; |
|---|
| 75 | + card->minor_rev = minor_rev; |
|---|
| 72 | 76 | card->num_info = nr_strings; |
|---|
| 73 | 77 | card->info = (const char**)buffer; |
|---|
| 74 | 78 | } |
|---|
| .. | .. |
|---|
| 388 | 392 | return ret; |
|---|
| 389 | 393 | |
|---|
| 390 | 394 | /* |
|---|
| 391 | | - * Since we've linked to tuples in the card structure, |
|---|
| 392 | | - * we must make sure we have a reference to it. |
|---|
| 393 | | - */ |
|---|
| 394 | | - get_device(&func->card->dev); |
|---|
| 395 | | - |
|---|
| 396 | | - /* |
|---|
| 397 | 395 | * Vendor/device id is optional for function CIS, so |
|---|
| 398 | 396 | * copy it from the card structure as needed. |
|---|
| 399 | 397 | */ |
|---|
| .. | .. |
|---|
| 418 | 416 | } |
|---|
| 419 | 417 | |
|---|
| 420 | 418 | func->tuples = NULL; |
|---|
| 421 | | - |
|---|
| 422 | | - /* |
|---|
| 423 | | - * We have now removed the link to the tuples in the |
|---|
| 424 | | - * card structure, so remove the reference. |
|---|
| 425 | | - */ |
|---|
| 426 | | - put_device(&func->card->dev); |
|---|
| 427 | 419 | } |
|---|
| 428 | 420 | |
|---|