]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
nfc: trf7970a: constify several pointers
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Thu, 29 Jul 2021 10:40:14 +0000 (12:40 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 29 Jul 2021 11:28:03 +0000 (12:28 +0100)
Several functions do not modify pointed data so arguments and local
variables can be const for correctness and safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/nfc/trf7970a.c

index 1aed44629aaaadf69f48c4add8044c2db47ed06c..8890fcd59c39eb66dcf8eca86b40713fc836f221 100644 (file)
@@ -643,7 +643,7 @@ static void trf7970a_send_err_upstream(struct trf7970a *trf, int errno)
 }
 
 static int trf7970a_transmit(struct trf7970a *trf, struct sk_buff *skb,
-                            unsigned int len, u8 *prefix,
+                            unsigned int len, const u8 *prefix,
                             unsigned int prefix_len)
 {
        struct spi_transfer t[2];
@@ -1387,9 +1387,10 @@ static int trf7970a_is_iso15693_write_or_lock(u8 cmd)
        }
 }
 
-static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
+static int trf7970a_per_cmd_config(struct trf7970a *trf,
+                                  const struct sk_buff *skb)
 {
-       u8 *req = skb->data;
+       const u8 *req = skb->data;
        u8 special_fcn_reg1, iso_ctrl;
        int ret;
 
@@ -1791,7 +1792,7 @@ out_err:
 static int trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
                              nfc_digital_cmd_complete_t cb, void *arg)
 {
-       struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
+       const struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
 
        dev_dbg(trf->dev, "Listen - state: %d, timeout: %d ms\n",
                trf->state, timeout);
@@ -1803,7 +1804,7 @@ static int trf7970a_tg_listen_md(struct nfc_digital_dev *ddev,
                                 u16 timeout, nfc_digital_cmd_complete_t cb,
                                 void *arg)
 {
-       struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
+       const struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
        int ret;
 
        dev_dbg(trf->dev, "Listen MD - state: %d, timeout: %d ms\n",
@@ -1824,7 +1825,7 @@ static int trf7970a_tg_listen_md(struct nfc_digital_dev *ddev,
 
 static int trf7970a_tg_get_rf_tech(struct nfc_digital_dev *ddev, u8 *rf_tech)
 {
-       struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
+       const struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
 
        dev_dbg(trf->dev, "Get RF Tech - state: %d, rf_tech: %d\n",
                trf->state, trf->md_rf_tech);
@@ -1974,7 +1975,7 @@ static void trf7970a_shutdown(struct trf7970a *trf)
        trf7970a_power_down(trf);
 }
 
-static int trf7970a_get_autosuspend_delay(struct device_node *np)
+static int trf7970a_get_autosuspend_delay(const struct device_node *np)
 {
        int autosuspend_delay, ret;
 
@@ -1987,7 +1988,7 @@ static int trf7970a_get_autosuspend_delay(struct device_node *np)
 
 static int trf7970a_probe(struct spi_device *spi)
 {
-       struct device_node *np = spi->dev.of_node;
+       const struct device_node *np = spi->dev.of_node;
        struct trf7970a *trf;
        int uvolts, autosuspend_delay, ret;
        u32 clk_freq = TRF7970A_13MHZ_CLOCK_FREQUENCY;