NFC: netlink: Rename CMD_FW_UPLOAD to CMD_FW_DOWNLOAD
Loading a firmware into a target is typically called firmware download, not firmware upload. So we rename the netlink API to NFC_CMD_FW_DOWNLOAD in order to avoid any terminology confusion from userspace. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
7427b370e0
commit
9ea7187c53
7 changed files with 29 additions and 29 deletions
|
@ -59,7 +59,7 @@ struct nfc_hci_ops {
|
||||||
struct nfc_target *target);
|
struct nfc_target *target);
|
||||||
int (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event,
|
int (*event_received)(struct nfc_hci_dev *hdev, u8 gate, u8 event,
|
||||||
struct sk_buff *skb);
|
struct sk_buff *skb);
|
||||||
int (*fw_upload)(struct nfc_hci_dev *hdev, const char *firmware_name);
|
int (*fw_download)(struct nfc_hci_dev *hdev, const char *firmware_name);
|
||||||
int (*discover_se)(struct nfc_hci_dev *dev);
|
int (*discover_se)(struct nfc_hci_dev *dev);
|
||||||
int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx);
|
int (*enable_se)(struct nfc_hci_dev *dev, u32 se_idx);
|
||||||
int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx);
|
int (*disable_se)(struct nfc_hci_dev *dev, u32 se_idx);
|
||||||
|
|
|
@ -68,7 +68,7 @@ struct nfc_ops {
|
||||||
void *cb_context);
|
void *cb_context);
|
||||||
int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb);
|
int (*tm_send)(struct nfc_dev *dev, struct sk_buff *skb);
|
||||||
int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
|
int (*check_presence)(struct nfc_dev *dev, struct nfc_target *target);
|
||||||
int (*fw_upload)(struct nfc_dev *dev, const char *firmware_name);
|
int (*fw_download)(struct nfc_dev *dev, const char *firmware_name);
|
||||||
|
|
||||||
/* Secure Element API */
|
/* Secure Element API */
|
||||||
int (*discover_se)(struct nfc_dev *dev);
|
int (*discover_se)(struct nfc_dev *dev);
|
||||||
|
@ -127,7 +127,7 @@ struct nfc_dev {
|
||||||
int targets_generation;
|
int targets_generation;
|
||||||
struct device dev;
|
struct device dev;
|
||||||
bool dev_up;
|
bool dev_up;
|
||||||
bool fw_upload_in_progress;
|
bool fw_download_in_progress;
|
||||||
u8 rf_mode;
|
u8 rf_mode;
|
||||||
bool polling;
|
bool polling;
|
||||||
struct nfc_target *active_target;
|
struct nfc_target *active_target;
|
||||||
|
|
|
@ -69,8 +69,8 @@
|
||||||
* starting a poll from a device which has a secure element enabled means
|
* starting a poll from a device which has a secure element enabled means
|
||||||
* we want to do SE based card emulation.
|
* we want to do SE based card emulation.
|
||||||
* @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element.
|
* @NFC_CMD_DISABLE_SE: Disable the physical link to a specific secure element.
|
||||||
* @NFC_CMD_FW_UPLOAD: Request to Load/flash firmware, or event to inform that
|
* @NFC_CMD_FW_DOWNLOAD: Request to Load/flash firmware, or event to inform
|
||||||
* some firmware was loaded
|
* that some firmware was loaded
|
||||||
*/
|
*/
|
||||||
enum nfc_commands {
|
enum nfc_commands {
|
||||||
NFC_CMD_UNSPEC,
|
NFC_CMD_UNSPEC,
|
||||||
|
@ -94,7 +94,7 @@ enum nfc_commands {
|
||||||
NFC_CMD_DISABLE_SE,
|
NFC_CMD_DISABLE_SE,
|
||||||
NFC_CMD_LLC_SDREQ,
|
NFC_CMD_LLC_SDREQ,
|
||||||
NFC_EVENT_LLC_SDRES,
|
NFC_EVENT_LLC_SDRES,
|
||||||
NFC_CMD_FW_UPLOAD,
|
NFC_CMD_FW_DOWNLOAD,
|
||||||
NFC_EVENT_SE_ADDED,
|
NFC_EVENT_SE_ADDED,
|
||||||
NFC_EVENT_SE_REMOVED,
|
NFC_EVENT_SE_REMOVED,
|
||||||
/* private: internal use only */
|
/* private: internal use only */
|
||||||
|
|
|
@ -44,7 +44,7 @@ DEFINE_MUTEX(nfc_devlist_mutex);
|
||||||
/* NFC device ID bitmap */
|
/* NFC device ID bitmap */
|
||||||
static DEFINE_IDA(nfc_index_ida);
|
static DEFINE_IDA(nfc_index_ida);
|
||||||
|
|
||||||
int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name)
|
int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
@ -62,28 +62,28 @@ int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dev->ops->fw_upload) {
|
if (!dev->ops->fw_download) {
|
||||||
rc = -EOPNOTSUPP;
|
rc = -EOPNOTSUPP;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->fw_upload_in_progress = true;
|
dev->fw_download_in_progress = true;
|
||||||
rc = dev->ops->fw_upload(dev, firmware_name);
|
rc = dev->ops->fw_download(dev, firmware_name);
|
||||||
if (rc)
|
if (rc)
|
||||||
dev->fw_upload_in_progress = false;
|
dev->fw_download_in_progress = false;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
device_unlock(&dev->dev);
|
device_unlock(&dev->dev);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nfc_fw_upload_done(struct nfc_dev *dev, const char *firmware_name)
|
int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name)
|
||||||
{
|
{
|
||||||
dev->fw_upload_in_progress = false;
|
dev->fw_download_in_progress = false;
|
||||||
|
|
||||||
return nfc_genl_fw_upload_done(dev, firmware_name);
|
return nfc_genl_fw_download_done(dev, firmware_name);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(nfc_fw_upload_done);
|
EXPORT_SYMBOL(nfc_fw_download_done);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nfc_dev_up - turn on the NFC device
|
* nfc_dev_up - turn on the NFC device
|
||||||
|
@ -110,7 +110,7 @@ int nfc_dev_up(struct nfc_dev *dev)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->fw_upload_in_progress) {
|
if (dev->fw_download_in_progress) {
|
||||||
rc = -EBUSY;
|
rc = -EBUSY;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -809,14 +809,14 @@ static void nfc_hci_recv_from_llc(struct nfc_hci_dev *hdev, struct sk_buff *skb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int hci_fw_upload(struct nfc_dev *nfc_dev, const char *firmware_name)
|
static int hci_fw_download(struct nfc_dev *nfc_dev, const char *firmware_name)
|
||||||
{
|
{
|
||||||
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
|
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
|
||||||
|
|
||||||
if (!hdev->ops->fw_upload)
|
if (!hdev->ops->fw_download)
|
||||||
return -ENOTSUPP;
|
return -ENOTSUPP;
|
||||||
|
|
||||||
return hdev->ops->fw_upload(hdev, firmware_name);
|
return hdev->ops->fw_download(hdev, firmware_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfc_ops hci_nfc_ops = {
|
static struct nfc_ops hci_nfc_ops = {
|
||||||
|
@ -831,7 +831,7 @@ static struct nfc_ops hci_nfc_ops = {
|
||||||
.im_transceive = hci_transceive,
|
.im_transceive = hci_transceive,
|
||||||
.tm_send = hci_tm_send,
|
.tm_send = hci_tm_send,
|
||||||
.check_presence = hci_check_presence,
|
.check_presence = hci_check_presence,
|
||||||
.fw_upload = hci_fw_upload,
|
.fw_download = hci_fw_download,
|
||||||
.discover_se = hci_discover_se,
|
.discover_se = hci_discover_se,
|
||||||
.enable_se = hci_enable_se,
|
.enable_se = hci_enable_se,
|
||||||
.disable_se = hci_disable_se,
|
.disable_se = hci_disable_se,
|
||||||
|
|
|
@ -1089,7 +1089,7 @@ exit:
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nfc_genl_fw_upload(struct sk_buff *skb, struct genl_info *info)
|
static int nfc_genl_fw_download(struct sk_buff *skb, struct genl_info *info)
|
||||||
{
|
{
|
||||||
struct nfc_dev *dev;
|
struct nfc_dev *dev;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -1108,13 +1108,13 @@ static int nfc_genl_fw_upload(struct sk_buff *skb, struct genl_info *info)
|
||||||
nla_strlcpy(firmware_name, info->attrs[NFC_ATTR_FIRMWARE_NAME],
|
nla_strlcpy(firmware_name, info->attrs[NFC_ATTR_FIRMWARE_NAME],
|
||||||
sizeof(firmware_name));
|
sizeof(firmware_name));
|
||||||
|
|
||||||
rc = nfc_fw_upload(dev, firmware_name);
|
rc = nfc_fw_download(dev, firmware_name);
|
||||||
|
|
||||||
nfc_put_device(dev);
|
nfc_put_device(dev);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name)
|
int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name)
|
||||||
{
|
{
|
||||||
struct sk_buff *msg;
|
struct sk_buff *msg;
|
||||||
void *hdr;
|
void *hdr;
|
||||||
|
@ -1124,7 +1124,7 @@ int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0,
|
hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0,
|
||||||
NFC_CMD_FW_UPLOAD);
|
NFC_CMD_FW_DOWNLOAD);
|
||||||
if (!hdr)
|
if (!hdr)
|
||||||
goto free_msg;
|
goto free_msg;
|
||||||
|
|
||||||
|
@ -1251,8 +1251,8 @@ static struct genl_ops nfc_genl_ops[] = {
|
||||||
.policy = nfc_genl_policy,
|
.policy = nfc_genl_policy,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = NFC_CMD_FW_UPLOAD,
|
.cmd = NFC_CMD_FW_DOWNLOAD,
|
||||||
.doit = nfc_genl_fw_upload,
|
.doit = nfc_genl_fw_download,
|
||||||
.policy = nfc_genl_policy,
|
.policy = nfc_genl_policy,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -123,10 +123,10 @@ static inline void nfc_device_iter_exit(struct class_dev_iter *iter)
|
||||||
class_dev_iter_exit(iter);
|
class_dev_iter_exit(iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
int nfc_fw_upload(struct nfc_dev *dev, const char *firmware_name);
|
int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name);
|
||||||
int nfc_genl_fw_upload_done(struct nfc_dev *dev, const char *firmware_name);
|
int nfc_genl_fw_download_done(struct nfc_dev *dev, const char *firmware_name);
|
||||||
|
|
||||||
int nfc_fw_upload_done(struct nfc_dev *dev, const char *firmware_name);
|
int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name);
|
||||||
|
|
||||||
int nfc_dev_up(struct nfc_dev *dev);
|
int nfc_dev_up(struct nfc_dev *dev);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue