Skip to content

Commit

Permalink
nfc: st-nci: set is_ese_present and is_uicc_present properly
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
cricard13 authored and Samuel Ortiz committed May 3, 2016
1 parent bd9d523 commit 27420fe
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
17 changes: 13 additions & 4 deletions drivers/nfc/st-nci/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ static int st_nci_i2c_acpi_request_resources(struct i2c_client *client)
const struct acpi_device_id *id;
struct gpio_desc *gpiod_reset;
struct device *dev;
u8 tmp;

if (!client)
return -EINVAL;
Expand All @@ -237,10 +238,18 @@ static int st_nci_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;
}
Expand Down
17 changes: 13 additions & 4 deletions drivers/nfc/st-nci/spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ static int st_nci_spi_acpi_request_resources(struct spi_device *spi_dev)
const struct acpi_device_id *id;
struct gpio_desc *gpiod_reset;
struct device *dev;
u8 tmp;

if (!spi_dev)
return -EINVAL;
Expand All @@ -252,10 +253,18 @@ static int st_nci_spi_acpi_request_resources(struct spi_device *spi_dev)

phy->irq_polarity = irq_get_trigger_type(spi_dev->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);
tmp = phy->se_status.is_ese_present;
}

if (device_property_present(dev, "uicc-present")) {
device_property_read_u8(dev, "uicc-present", &tmp);
tmp = phy->se_status.is_uicc_present;
}

return 0;
}
Expand Down

0 comments on commit 27420fe

Please sign in to comment.