iommu/arm-smmu: override bool option
Hiroshi Doyu [Wed, 25 Mar 2015 15:36:30 +0000 (17:36 +0200)]
Allow to override bool option if the same bool starts with '-'.

Bug 1610014
Bug 1610542
Bug 1618080

Change-Id: Ibc496f9d204edf6528a3f23f41890e0a73e11b97
Tested-by: Antti P Miettinen <amiettinen@nvidia.com>
Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com>
Reviewed-on: http://git-master/r/722818
Reviewed-by: Vandana Salve <vsalve@nvidia.com>

drivers/iommu/arm-smmu.c

index ca1c0d3..d066b60 100644 (file)
@@ -516,6 +516,7 @@ struct arm_smmu_option_prop {
 
 static struct arm_smmu_option_prop arm_smmu_options[] = {
        { ARM_SMMU_OPT_SECURE_CFG_ACCESS, "calxeda,smmu-secure-config-access" },
+       { ARM_SMMU_OPT_SECURE_CFG_ACCESS, "-calxeda,smmu-secure-config-access" },
        { 0, NULL},
 };
 
@@ -526,7 +527,10 @@ static void parse_driver_options(struct arm_smmu_device *smmu)
        do {
                if (of_property_read_bool(smmu->dev->of_node,
                                                arm_smmu_options[i].prop)) {
-                       smmu->options |= arm_smmu_options[i].opt;
+                       if (arm_smmu_options[i].prop[0] == '-')
+                               smmu->options &= ~arm_smmu_options[i].opt;
+                       else
+                               smmu->options |= arm_smmu_options[i].opt;
                        dev_notice(smmu->dev, "option %s\n",
                                arm_smmu_options[i].prop);
                }