nfc: st21nfca: set is_ese_present and is_uicc_present properly
authorChristophe Ricard <christophe.ricard@gmail.com>
Sat, 30 Apr 2016 07:12:38 +0000 (09:12 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 3 May 2016 23:29:57 +0000 (01:29 +0200)
When they're present, set is_ese_present and set is_uicc_present
to the value describe in their package description.

So far is_ese_present and is_uicc_present was set to true if their
property was present.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/st21nfca/i2c.c

index 179c0b8edf8d95f549828f6d01aa62f60c5f7053..a3153a30be5d91d6d50b234f9f96c6b96b223c62 100644 (file)
@@ -510,6 +510,7 @@ static int st21nfca_hci_i2c_acpi_request_resources(struct i2c_client *client)
        const struct acpi_device_id *id;
        struct gpio_desc *gpiod_ena;
        struct device *dev;
+       u8 tmp;
 
        if (!client)
                return -EINVAL;
@@ -533,10 +534,18 @@ static int st21nfca_hci_i2c_acpi_request_resources(struct i2c_client *client)
 
        phy->irq_polarity = irq_get_trigger_type(client->irq);
 
-       phy->se_status.is_ese_present =
-                               device_property_present(dev, "ese-present");
-       phy->se_status.is_uicc_present =
-                               device_property_present(dev, "uicc-present");
+       phy->se_status.is_ese_present = false;
+       phy->se_status.is_uicc_present = false;
+
+       if (device_property_present(dev, "ese-present")) {
+               device_property_read_u8(dev, "ese-present", &tmp);
+               phy->se_status.is_ese_present = tmp;
+       }
+
+       if (device_property_present(dev, "uicc-present")) {
+               device_property_read_u8(dev, "uicc-present", &tmp);
+               phy->se_status.is_uicc_present = tmp;
+       }
 
        return 0;
 }