This constifies the sensor tables of the lm(4), uguru(4), fins(4), and wbenv(4) drivers, which all share the same basic design.
ok? diff refs/heads/master refs/heads/const_sensors blob - a813447ec9521a2a11a8b1f5daa38b881da007c1 blob + 3a1b2bfdc2b1d92d62f3b156479ad0ff5b57e463 --- sys/dev/i2c/w83l784r.c +++ sys/dev/i2c/w83l784r.c @@ -80,14 +80,14 @@ struct wbenv_softc { struct ksensor sc_sensors[WBENV_MAX_SENSORS]; struct ksensordev sc_sensordev; - struct wbenv_sensor *sc_wbenv_sensors; + const struct wbenv_sensor *sc_wbenv_sensors; int sc_numsensors; }; int wbenv_match(struct device *, void *, void *); void wbenv_attach(struct device *, struct device *, void *); -void wbenv_setup_sensors(struct wbenv_softc *, struct wbenv_sensor *); +void wbenv_setup_sensors(struct wbenv_softc *, const struct wbenv_sensor *); void wbenv_refresh(void *); void w83l784r_refresh_volt(struct wbenv_softc *, int); @@ -108,7 +108,7 @@ struct cfdriver wbenv_cd = { NULL, "wbenv", DV_DULL }; -struct wbenv_sensor w83l784r_sensors[] = +const struct wbenv_sensor w83l784r_sensors[] = { { "VCore", SENSOR_VOLTS_DC, W83L784R_VCORE, w83l784r_refresh_volt, RFACT_NONE }, { "VBAT", SENSOR_VOLTS_DC, W83L784R_VBAT, w83l784r_refresh_volt, RFACT(232, 99) }, @@ -123,7 +123,7 @@ struct wbenv_sensor w83l784r_sensors[] = { NULL } }; -struct wbenv_sensor w83l785r_sensors[] = +const struct wbenv_sensor w83l785r_sensors[] = { { "VCore", SENSOR_VOLTS_DC, W83L784R_VCORE, w83l785r_refresh_volt, RFACT_NONE }, { "+2.5V", SENSOR_VOLTS_DC, W83L785R_2_5V, w83l785r_refresh_volt, RFACT(100, 100) }, @@ -137,7 +137,7 @@ struct wbenv_sensor w83l785r_sensors[] = { NULL } }; -struct wbenv_sensor w83l785ts_l_sensors[] = +const struct wbenv_sensor w83l785ts_l_sensors[] = { { "", SENSOR_TEMP, W83L784R_TEMP1, wbenv_refresh_temp }, @@ -236,7 +236,7 @@ wbenv_attach(struct device *parent, struct device *sel } void -wbenv_setup_sensors(struct wbenv_softc *sc, struct wbenv_sensor *sensors) +wbenv_setup_sensors(struct wbenv_softc *sc, const struct wbenv_sensor *sensors) { int i; blob - 88538623a7a7681f9cee6206fe48770a41b700ab blob + be17af240b07da9bd1168d748354440d763a0419 --- sys/dev/ic/lm78.c +++ sys/dev/ic/lm78.c @@ -51,7 +51,7 @@ int lm_match(struct lm_softc *); int wb_match(struct lm_softc *); int def_match(struct lm_softc *); -void lm_setup_sensors(struct lm_softc *, struct lm_sensor *); +void lm_setup_sensors(struct lm_softc *, const struct lm_sensor *); void lm_refresh(void *); void lm_refresh_sensor_data(struct lm_softc *); @@ -74,13 +74,13 @@ struct lm_chip { int (*chip_match)(struct lm_softc *); }; -struct lm_chip lm_chips[] = { +const struct lm_chip lm_chips[] = { { wb_match }, { lm_match }, { def_match } /* Must be last */ }; -struct lm_sensor lm78_sensors[] = { +const struct lm_sensor lm78_sensors[] = { /* Voltage */ { "VCore A", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE }, { "VCore B", SENSOR_VOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE }, @@ -101,7 +101,7 @@ struct lm_sensor lm78_sensors[] = { { NULL } }; -struct lm_sensor w83627hf_sensors[] = { +const struct lm_sensor w83627hf_sensors[] = { /* Voltage */ { "VCore A", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE }, { "VCore B", SENSOR_VOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE }, @@ -133,7 +133,7 @@ struct lm_sensor w83627hf_sensors[] = { * need special treatment, also because the reference voltage is 2.048 V * instead of the traditional 3.6 V. */ -struct lm_sensor w83627ehf_sensors[] = { +const struct lm_sensor w83627ehf_sensors[] = { /* Voltage */ { "VCore", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE / 2}, { "+12V", SENSOR_VOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT(56, 10) / 2 }, @@ -163,7 +163,7 @@ struct lm_sensor w83627ehf_sensors[] = { * w83627dhg is almost identical to w83627ehf, except that * it has 9 instead of 10 voltage sensors */ -struct lm_sensor w83627dhg_sensors[] = { +const struct lm_sensor w83627dhg_sensors[] = { /* Voltage */ { "VCore", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE / 2}, { "+12V", SENSOR_VOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT(56, 10) / 2 }, @@ -188,7 +188,7 @@ struct lm_sensor w83627dhg_sensors[] = { { NULL } }; -struct lm_sensor nct6776f_sensors[] = { +const struct lm_sensor nct6776f_sensors[] = { /* Voltage */ { "VCore", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE / 2}, { "+12V", SENSOR_VOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT(56, 10) / 2 }, @@ -216,7 +216,7 @@ struct lm_sensor nct6776f_sensors[] = { }; /* NCT6779D */ -struct lm_sensor nct6779d_sensors[] = { +const struct lm_sensor nct6779d_sensors[] = { /* Voltage */ { "VCore", SENSOR_VOLTS_DC, 4, 0x80, lm_refresh_volt, RFACT_NONE }, { "VIN1", SENSOR_VOLTS_DC, 4, 0x81, lm_refresh_volt, RFACT(56, 10) / 2 }, @@ -252,7 +252,7 @@ struct lm_sensor nct6779d_sensors[] = { { NULL } }; -struct lm_sensor w83637hf_sensors[] = { +const struct lm_sensor w83637hf_sensors[] = { /* Voltage */ { "VCore", SENSOR_VOLTS_DC, 0, 0x20, wb_w83637hf_refresh_vcore }, { "+12V", SENSOR_VOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT(28, 10) }, @@ -275,7 +275,7 @@ struct lm_sensor w83637hf_sensors[] = { { NULL } }; -struct lm_sensor w83697hf_sensors[] = { +const struct lm_sensor w83697hf_sensors[] = { /* Voltage */ { "VCore", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE }, { "+3.3V", SENSOR_VOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE }, @@ -302,7 +302,7 @@ struct lm_sensor w83697hf_sensors[] = { * +5V, but using the values from the W83782D datasheets seems to * provide sensible results. */ -struct lm_sensor w83781d_sensors[] = { +const struct lm_sensor w83781d_sensors[] = { /* Voltage */ { "VCore A", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE }, { "VCore B", SENSOR_VOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE }, @@ -325,7 +325,7 @@ struct lm_sensor w83781d_sensors[] = { { NULL } }; -struct lm_sensor w83782d_sensors[] = { +const struct lm_sensor w83782d_sensors[] = { /* Voltage */ { "VCore", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE }, { "VINR0", SENSOR_VOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE }, @@ -350,7 +350,7 @@ struct lm_sensor w83782d_sensors[] = { { NULL } }; -struct lm_sensor w83783s_sensors[] = { +const struct lm_sensor w83783s_sensors[] = { /* Voltage */ { "VCore", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE }, { "+3.3V", SENSOR_VOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE }, @@ -371,7 +371,7 @@ struct lm_sensor w83783s_sensors[] = { { NULL } }; -struct lm_sensor w83791d_sensors[] = { +const struct lm_sensor w83791d_sensors[] = { /* Voltage */ { "VCore", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, 10000 }, { "VINR0", SENSOR_VOLTS_DC, 0, 0x21, lm_refresh_volt, 10000 }, @@ -399,7 +399,7 @@ struct lm_sensor w83791d_sensors[] = { { NULL } }; -struct lm_sensor w83792d_sensors[] = { +const struct lm_sensor w83792d_sensors[] = { /* Voltage */ { "VCore A", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE }, { "VCore B", SENSOR_VOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE }, @@ -428,7 +428,7 @@ struct lm_sensor w83792d_sensors[] = { { NULL } }; -struct lm_sensor as99127f_sensors[] = { +const struct lm_sensor as99127f_sensors[] = { /* Voltage */ { "VCore A", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE }, { "VCore B", SENSOR_VOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE }, @@ -662,7 +662,7 @@ wb_match(struct lm_softc *sc) } void -lm_setup_sensors(struct lm_softc *sc, struct lm_sensor *sensors) +lm_setup_sensors(struct lm_softc *sc, const struct lm_sensor *sensors) { int i; blob - 374b208bf81f7bbac46038bccf4de0bcfeba1e5e blob + 1384c758e656ac7e0aa0104c46fa2600de45ba58 --- sys/dev/ic/lm78var.h +++ sys/dev/ic/lm78var.h @@ -142,7 +142,7 @@ struct lm_softc { struct ksensor sensors[WB_MAX_SENSORS]; struct ksensordev sensordev; struct sensor_task *sensortask; - struct lm_sensor *lm_sensors; + const struct lm_sensor *lm_sensors; u_int numsensors; void (*refresh_sensor_data) (struct lm_softc *); blob - 7261317d34ce077cea2b6bca8865a7750324fe65 blob + b7d90e134d13c33dec81aded3bec2a28e7953d34 --- sys/dev/isa/fins.c +++ sys/dev/isa/fins.c @@ -111,7 +111,7 @@ struct fins_softc { struct ksensor fins_ksensors[FINS_MAX_SENSORS]; struct ksensordev fins_sensordev; struct sensor_task *fins_sensortask; - struct fins_sensor *fins_sensors; + const struct fins_sensor *fins_sensors; bus_space_handle_t sc_ioh_sens; bus_space_handle_t sc_ioh_wdog; @@ -139,7 +139,7 @@ static __inline u_int16_t fins_read_sens_2(struct fins static __inline u_int8_t fins_read_wdog(struct fins_softc *, int); static __inline void fins_write_wdog(struct fins_softc *, int, u_int8_t); -void fins_setup_sensors(struct fins_softc *, struct fins_sensor *); +void fins_setup_sensors(struct fins_softc *, const struct fins_sensor *); void fins_refresh(void *); void fins_get_rpm(struct fins_softc *, int); @@ -160,7 +160,7 @@ struct cfdriver fins_cd = { NULL, "fins", DV_DULL }; -struct fins_sensor fins_71805_sensors[] = { +const struct fins_sensor fins_71805_sensors[] = { { "+3.3V", fins_get_volt, SENSOR_VOLTS_DC, FRFACT(100, 100), 0x10 }, { "Vtt", fins_get_volt, SENSOR_VOLTS_DC, FRFACT_NONE, 0x11 }, { "Vram", fins_get_volt, SENSOR_VOLTS_DC, FRFACT(100, 100), 0x12 }, @@ -184,7 +184,7 @@ struct fins_sensor fins_71805_sensors[] = { { NULL } }; -struct fins_sensor fins_71882_sensors[] = { +const struct fins_sensor fins_71882_sensors[] = { { "+3.3V", fins_get_volt, SENSOR_VOLTS_DC, FRFACT(100, 100), 0x20 }, { "Vcore", fins_get_volt, SENSOR_VOLTS_DC, FRFACT_NONE, 0x21 }, { "Vram", fins_get_volt, SENSOR_VOLTS_DC, FRFACT(100, 100), 0x22 }, @@ -384,7 +384,7 @@ fins_lock(bus_space_tag_t iot, bus_space_handle_t ioh) } void -fins_setup_sensors(struct fins_softc *sc, struct fins_sensor *sensors) +fins_setup_sensors(struct fins_softc *sc, const struct fins_sensor *sensors) { int i; @@ -431,7 +431,7 @@ void fins_get_volt(struct fins_softc *sc, int n) { struct ksensor *sensor = &sc->fins_ksensors[n]; - struct fins_sensor *fs = &sc->fins_sensors[n]; + const struct fins_sensor *fs = &sc->fins_sensors[n]; int data; data = fins_read_sens(sc, fs->fs_reg); @@ -449,7 +449,7 @@ void fins_get_temp(struct fins_softc *sc, int n) { struct ksensor *sensor = &sc->fins_ksensors[n]; - struct fins_sensor *fs = &sc->fins_sensors[n]; + const struct fins_sensor *fs = &sc->fins_sensors[n]; u_int data; u_int max; @@ -477,7 +477,7 @@ void fins_refresh_offset(struct fins_softc *sc, int n) { struct ksensor *sensor = &sc->fins_ksensors[n]; - struct fins_sensor *fs = &sc->fins_sensors[n]; + const struct fins_sensor *fs = &sc->fins_sensors[n]; u_int data; sensor->flags &= ~SENSOR_FINVALID; @@ -492,7 +492,7 @@ void fins_get_rpm(struct fins_softc *sc, int n) { struct ksensor *sensor = &sc->fins_ksensors[n]; - struct fins_sensor *fs = &sc->fins_sensors[n]; + const struct fins_sensor *fs = &sc->fins_sensors[n]; int data; data = fins_read_sens_2(sc, fs->fs_reg); blob - 80612b18f499e7d7f3d99af281ee40aa2d24b04f blob + da61593b74edb1f352138f7e283d7041d979bfdd --- sys/dev/isa/uguru.c +++ sys/dev/isa/uguru.c @@ -100,7 +100,7 @@ struct uguru_softc { struct ksensor sc_sensors[UGURU_MAX_SENSORS]; struct ksensordev sc_sensordev; int sc_numsensors; - struct uguru_sensor *uguru_sensors; + const struct uguru_sensor *uguru_sensors; struct { uint8_t reading; /* uint8_t flags; */ @@ -126,7 +126,7 @@ void uguru_refresh_fan(struct uguru_softc *, int); #define UGURU_R_VOLT uguru_refresh_volt #define UGURU_R_FAN uguru_refresh_fan -struct uguru_sensor abitkv_sensors[] = { +const struct uguru_sensor abitkv_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 }, { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x0f }, @@ -148,7 +148,7 @@ struct uguru_sensor abitkv_sensors[] = { { NULL } }; -struct uguru_sensor abitaa_sensors[] = { +const struct uguru_sensor abitaa_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 }, { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x0f }, @@ -174,7 +174,7 @@ struct uguru_sensor abitaa_sensors[] = { { NULL } }; -struct uguru_sensor abitav_sensors[] = { +const struct uguru_sensor abitav_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 }, { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x0f }, @@ -200,7 +200,7 @@ struct uguru_sensor abitav_sensors[] = { { NULL } }; -struct uguru_sensor abitas_sensors[] = { +const struct uguru_sensor abitas_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 }, { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x0f }, @@ -226,7 +226,7 @@ struct uguru_sensor abitas_sensors[] = { { NULL } }; -struct uguru_sensor abitax_sensors[] = { +const struct uguru_sensor abitax_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 }, { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x0f }, @@ -250,7 +250,7 @@ struct uguru_sensor abitax_sensors[] = { { NULL } }; -struct uguru_sensor abitm4_sensors[] = { +const struct uguru_sensor abitm4_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 }, { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x02 }, @@ -278,7 +278,7 @@ struct uguru_sensor abitm4_sensors[] = { { NULL } }; -struct uguru_sensor abitan_sensors[] = { +const struct uguru_sensor abitan_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x00 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x01 }, { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x0f }, @@ -305,7 +305,7 @@ struct uguru_sensor abitan_sensors[] = { { NULL } }; -struct uguru_sensor abital_sensors[] = { +const struct uguru_sensor abital_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 }, { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1a }, @@ -331,7 +331,7 @@ struct uguru_sensor abital_sensors[] = { { NULL } }; -struct uguru_sensor abitaw_sensors[] = { +const struct uguru_sensor abitaw_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 }, { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x1a }, @@ -364,7 +364,7 @@ struct uguru_sensor abitaw_sensors[] = { { NULL } }; -struct uguru_sensor abitni_sensors[] = { +const struct uguru_sensor abitni_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 }, { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1a }, @@ -391,7 +391,7 @@ struct uguru_sensor abitni_sensors[] = { { NULL } }; -struct uguru_sensor abitat_sensors[] = { +const struct uguru_sensor abitat_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 }, { "NB", SENSOR_TEMP, UGURU_R_TEMP, 0x19 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x1a }, @@ -422,7 +422,7 @@ struct uguru_sensor abitat_sensors[] = { { NULL } }; -struct uguru_sensor abitan2_sensors[] = { +const struct uguru_sensor abitan2_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 }, { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1a }, @@ -449,7 +449,7 @@ struct uguru_sensor abitan2_sensors[] = { { NULL } }; -struct uguru_sensor abitab_sensors[] = { +const struct uguru_sensor abitab_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 }, { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1a }, @@ -477,7 +477,7 @@ struct uguru_sensor abitab_sensors[] = { { NULL } }; -struct uguru_sensor abitan3_sensors[] = { +const struct uguru_sensor abitan3_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 }, { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1a }, @@ -506,7 +506,7 @@ struct uguru_sensor abitan3_sensors[] = { { NULL } }; -struct uguru_sensor abitaw2_sensors[] = { +const struct uguru_sensor abitaw2_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 }, { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x1a }, @@ -539,7 +539,7 @@ struct uguru_sensor abitaw2_sensors[] = { { NULL } }; -struct uguru_sensor abitat2_sensors[] = { +const struct uguru_sensor abitat2_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x1a }, { "PWM", SENSOR_TEMP, UGURU_R_TEMP, 0x1b }, @@ -569,7 +569,7 @@ struct uguru_sensor abitat2_sensors[] = { { NULL } }; -struct uguru_sensor abitab2_sensors[] = { +const struct uguru_sensor abitab2_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 }, { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x1a }, @@ -601,7 +601,7 @@ struct uguru_sensor abitab2_sensors[] = { { NULL } }; -struct uguru_sensor abitin_sensors[] = { +const struct uguru_sensor abitin_sensors[] = { { "CPU", SENSOR_TEMP, UGURU_R_TEMP, 0x18 }, { "SYS", SENSOR_TEMP, UGURU_R_TEMP, 0x19 }, { "PWM1", SENSOR_TEMP, UGURU_R_TEMP, 0x1a }, @@ -694,7 +694,7 @@ uguru_attach(struct device *parent, struct device *sel { struct uguru_softc *sc = (void *)self; struct isa_attach_args *ia = aux; - struct uguru_sensor *sensors; + const struct uguru_sensor *sensors; uint8_t data[9]; uint16_t vendid, devid, sysid; int i; -- Christian "naddy" Weisgerber na...@mips.inka.de