Эх сурвалжийг харах

i2c-i801: Don't depend on other kernel driver config options

Don't let other driver config options influence us, as it makes the
code more complex and fragile for a small benefit. There's nothing
wrong with instantiating I2C devices even if they don't have a driver.
And we're talking about 835 extra bytes in the binary on x86-64,
that's hardly worth arguing about.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: David Woodhouse <david.woodhouse@intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Jean Delvare 14 жил өмнө
parent
commit
8eacfcebf0

+ 1 - 0
drivers/i2c/busses/Kconfig

@@ -79,6 +79,7 @@ config I2C_AMD8111
 config I2C_I801
 config I2C_I801
 	tristate "Intel 82801 (ICH/PCH)"
 	tristate "Intel 82801 (ICH/PCH)"
 	depends on PCI
 	depends on PCI
+	select CHECK_SIGNATURE if X86 && DMI
 	help
 	help
 	  If you say yes to this option, support will be included for the Intel
 	  If you say yes to this option, support will be included for the Intel
 	  801 family of mainboard I2C interfaces.  Specifically, the following
 	  801 family of mainboard I2C interfaces.  Specifically, the following

+ 6 - 10
drivers/i2c/busses/i2c-i801.c

@@ -638,7 +638,7 @@ static const struct pci_device_id i801_ids[] = {
 
 
 MODULE_DEVICE_TABLE(pci, i801_ids);
 MODULE_DEVICE_TABLE(pci, i801_ids);
 
 
-#if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE
+#if defined CONFIG_X86 && defined CONFIG_DMI
 static unsigned char apanel_addr;
 static unsigned char apanel_addr;
 
 
 /* Scan the system ROM for the signature "FJKEYINF" */
 /* Scan the system ROM for the signature "FJKEYINF" */
@@ -668,11 +668,7 @@ static void __init input_apanel_init(void)
 	}
 	}
 	iounmap(bios);
 	iounmap(bios);
 }
 }
-#else
-static void __init input_apanel_init(void) {}
-#endif
 
 
-#if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE
 struct dmi_onboard_device_info {
 struct dmi_onboard_device_info {
 	const char *name;
 	const char *name;
 	u8 type;
 	u8 type;
@@ -738,7 +734,6 @@ static void __devinit dmi_check_onboard_devices(const struct dmi_header *dm,
 		dmi_check_onboard_device(type, name, adap);
 		dmi_check_onboard_device(type, name, adap);
 	}
 	}
 }
 }
-#endif
 
 
 /* Register optional slaves */
 /* Register optional slaves */
 static void __devinit i801_probe_optional_slaves(struct i801_priv *priv)
 static void __devinit i801_probe_optional_slaves(struct i801_priv *priv)
@@ -747,7 +742,6 @@ static void __devinit i801_probe_optional_slaves(struct i801_priv *priv)
 	if (priv->features & FEATURE_IDF)
 	if (priv->features & FEATURE_IDF)
 		return;
 		return;
 
 
-#if defined CONFIG_INPUT_APANEL || defined CONFIG_INPUT_APANEL_MODULE
 	if (apanel_addr) {
 	if (apanel_addr) {
 		struct i2c_board_info info;
 		struct i2c_board_info info;
 
 
@@ -756,12 +750,14 @@ static void __devinit i801_probe_optional_slaves(struct i801_priv *priv)
 		strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE);
 		strlcpy(info.type, "fujitsu_apanel", I2C_NAME_SIZE);
 		i2c_new_device(&priv->adapter, &info);
 		i2c_new_device(&priv->adapter, &info);
 	}
 	}
-#endif
-#if defined CONFIG_SENSORS_FSCHMD || defined CONFIG_SENSORS_FSCHMD_MODULE
+
 	if (dmi_name_in_vendors("FUJITSU"))
 	if (dmi_name_in_vendors("FUJITSU"))
 		dmi_walk(dmi_check_onboard_devices, &priv->adapter);
 		dmi_walk(dmi_check_onboard_devices, &priv->adapter);
-#endif
 }
 }
+#else
+static void __init input_apanel_init(void) {}
+static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {}
+#endif	/* CONFIG_X86 && CONFIG_DMI */
 
 
 static int __devinit i801_probe(struct pci_dev *dev,
 static int __devinit i801_probe(struct pci_dev *dev,
 				const struct pci_device_id *id)
 				const struct pci_device_id *id)