--- zzzz-none-000/linux-3.10.107/drivers/hwmon/sht15.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/hwmon/sht15.c 2021-02-04 17:41:59.000000000 +0000 @@ -33,6 +33,7 @@ #include #include #include +#include /* Commands */ #define SHT15_MEASURE_TEMP 0x03 @@ -173,19 +174,6 @@ }; /** - * sht15_reverse() - reverse a byte - * @byte: byte to reverse. - */ -static u8 sht15_reverse(u8 byte) -{ - u8 i, c; - - for (c = 0, i = 0; i < 8; i++) - c |= (!!(byte & (1 << i))) << (7 - i); - return c; -} - -/** * sht15_crc8() - compute crc8 * @data: sht15 specific data. * @value: sht15 retrieved data. @@ -196,7 +184,7 @@ const u8 *value, int len) { - u8 crc = sht15_reverse(data->val_status & 0x0F); + u8 crc = bitrev8(data->val_status & 0x0F); while (len--) { crc = sht15_crc8_table[*value ^ crc]; @@ -477,7 +465,7 @@ if (data->checksumming) { sht15_ack(data); - dev_checksum = sht15_reverse(sht15_read_byte(data)); + dev_checksum = bitrev8(sht15_read_byte(data)); checksum_vals[0] = SHT15_READ_STATUS; checksum_vals[1] = status; data->checksum_ok = (sht15_crc8(data, checksum_vals, 2) @@ -864,7 +852,7 @@ */ if (sht15_ack(data)) goto wakeup; - dev_checksum = sht15_reverse(sht15_read_byte(data)); + dev_checksum = bitrev8(sht15_read_byte(data)); checksum_vals[0] = (data->state == SHT15_READING_TEMP) ? SHT15_MEASURE_TEMP : SHT15_MEASURE_RH; checksum_vals[1] = (u8) (val >> 8); @@ -940,11 +928,11 @@ data->dev = &pdev->dev; init_waitqueue_head(&data->wait_queue); - if (pdev->dev.platform_data == NULL) { + if (dev_get_platdata(&pdev->dev) == NULL) { dev_err(&pdev->dev, "no platform data supplied\n"); return -EINVAL; } - data->pdata = pdev->dev.platform_data; + data->pdata = dev_get_platdata(&pdev->dev); data->supply_uv = data->pdata->supply_mv * 1000; if (data->pdata->checksum) data->checksumming = true; @@ -957,7 +945,7 @@ * If a regulator is available, * query what the supply voltage actually is! */ - data->reg = devm_regulator_get(data->dev, "vcc"); + data->reg = devm_regulator_get_optional(data->dev, "vcc"); if (!IS_ERR(data->reg)) { int voltage; @@ -1074,7 +1062,7 @@ return 0; } -static struct platform_device_id sht15_device_ids[] = { +static const struct platform_device_id sht15_device_ids[] = { { "sht10", sht10 }, { "sht11", sht11 }, { "sht15", sht15 }, @@ -1087,7 +1075,6 @@ static struct platform_driver sht15_driver = { .driver = { .name = "sht15", - .owner = THIS_MODULE, }, .probe = sht15_probe, .remove = sht15_remove,