mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 04:34:11 +08:00
Fix root cause of crash/error seen in applesmc driver
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJSVdBGAAoJEMsfJm/On5mBj50P/1eQe5O/CsWLSYOx9ZcrglrH h80vl+/M3nySMwJcomBQuE93z0bA4b+laMgjkHA/z4RT9xxzowyCAlrwceiPQQM3 YgJ2rlIj6byo+LLJR9nA0VTrtO71ELakEtbec6rPvY8keGtRMWEdS/KiHQT3+pNt xeDL524nkC6yVmbtMYHX7KnD7srtkGbAhFWTFz69J6TpP9PswMdF70Pf+tRieE0O RcHbrZ2sw1qYKRG99TXSpTDvncjflkdyckfuEP3P88bz31KsNa1DiwkwrWw8qHoT Am1b205c1QKdWowXEvEcgnuZJWPer3VycPWTfebwYjSwpS4MwGefWNhC/Ul3n5al 75KXIV1r90TKOWATOQ7EnMRZh8NesOQfuE/3s3wQxwUZqQwI+qNhVSv1Owx7q8aK fLZJlOmdrk2o5fHiZjxAGQ9TQ9TTESLMD/5274Bua/YJ7Fs5YQT4xofDJnhp3jYU DV6f0pXQTvsWpuVfi//K0Sq36siqJyloIhD+hT7GR007U3RREPLDfC9Qdir6YUEf iYg+0bDBruBb8co1RTyFWgsYzfTdGSZU967hZb/hDLBRCk4rAbB6ttTT4ySpKlbW gO+B6eS3e523wma6gMGQeG+AGzGYWKSC2zG//Wd2VPOZwXx7c8kF6uxqLxKAmzvZ ymd2smSeJu195OU3PXWS =Y7mi -----END PGP SIGNATURE----- Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon fix from Guenter Roeck: "Fix root cause of crash/error seen in applesmc driver" * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (applesmc) Always read until end of data
This commit is contained in:
commit
e3e8ded06f
@ -230,6 +230,7 @@ static int send_argument(const char *key)
|
||||
|
||||
static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len)
|
||||
{
|
||||
u8 status, data = 0;
|
||||
int i;
|
||||
|
||||
if (send_command(cmd) || send_argument(key)) {
|
||||
@ -237,6 +238,7 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* This has no effect on newer (2012) SMCs */
|
||||
if (send_byte(len, APPLESMC_DATA_PORT)) {
|
||||
pr_warn("%.4s: read len fail\n", key);
|
||||
return -EIO;
|
||||
@ -250,6 +252,17 @@ static int read_smc(u8 cmd, const char *key, u8 *buffer, u8 len)
|
||||
buffer[i] = inb(APPLESMC_DATA_PORT);
|
||||
}
|
||||
|
||||
/* Read the data port until bit0 is cleared */
|
||||
for (i = 0; i < 16; i++) {
|
||||
udelay(APPLESMC_MIN_WAIT);
|
||||
status = inb(APPLESMC_CMD_PORT);
|
||||
if (!(status & 0x01))
|
||||
break;
|
||||
data = inb(APPLESMC_DATA_PORT);
|
||||
}
|
||||
if (i)
|
||||
pr_warn("flushed %d bytes, last value is: %d\n", i, data);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user