mei.c (b26864cad1c9f66f4966726ba7bc81d2b9b8f990) mei.c (893913822e829f7a37824f6041ff964076374191)
1/*
2 * HCI based Driver for NXP pn544 NFC Chip
3 *
4 * Copyright (C) 2013 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.

--- 13 unchanged lines hidden (view full) ---

22#include <net/nfc/hci.h>
23#include <net/nfc/llc.h>
24
25#include "../mei_phy.h"
26#include "pn544.h"
27
28#define PN544_DRIVER_NAME "pn544"
29
1/*
2 * HCI based Driver for NXP pn544 NFC Chip
3 *
4 * Copyright (C) 2013 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.

--- 13 unchanged lines hidden (view full) ---

22#include <net/nfc/hci.h>
23#include <net/nfc/llc.h>
24
25#include "../mei_phy.h"
26#include "pn544.h"
27
28#define PN544_DRIVER_NAME "pn544"
29
30static int pn544_mei_probe(struct mei_cl_device *device,
30static int pn544_mei_probe(struct mei_cl_device *cldev,
31 const struct mei_cl_device_id *id)
32{
33 struct nfc_mei_phy *phy;
34 int r;
35
36 pr_info("Probing NFC pn544\n");
37
31 const struct mei_cl_device_id *id)
32{
33 struct nfc_mei_phy *phy;
34 int r;
35
36 pr_info("Probing NFC pn544\n");
37
38 phy = nfc_mei_phy_alloc(device);
38 phy = nfc_mei_phy_alloc(cldev);
39 if (!phy) {
40 pr_err("Cannot allocate memory for pn544 mei phy.\n");
41 return -ENOMEM;
42 }
43
44 r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME,
45 MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD,
46 NULL, &phy->hdev);
47 if (r < 0) {
48 nfc_mei_phy_free(phy);
49
50 return r;
51 }
52
53 return 0;
54}
55
39 if (!phy) {
40 pr_err("Cannot allocate memory for pn544 mei phy.\n");
41 return -ENOMEM;
42 }
43
44 r = pn544_hci_probe(phy, &mei_phy_ops, LLC_NOP_NAME,
45 MEI_NFC_HEADER_SIZE, 0, MEI_NFC_MAX_HCI_PAYLOAD,
46 NULL, &phy->hdev);
47 if (r < 0) {
48 nfc_mei_phy_free(phy);
49
50 return r;
51 }
52
53 return 0;
54}
55
56static int pn544_mei_remove(struct mei_cl_device *device)
56static int pn544_mei_remove(struct mei_cl_device *cldev)
57{
57{
58 struct nfc_mei_phy *phy = mei_cl_get_drvdata(device);
58 struct nfc_mei_phy *phy = mei_cl_get_drvdata(cldev);
59
60 pr_info("Removing pn544\n");
61
62 pn544_hci_remove(phy->hdev);
63
64 nfc_mei_phy_free(phy);
65
66 return 0;

--- 43 unchanged lines hidden ---
59
60 pr_info("Removing pn544\n");
61
62 pn544_hci_remove(phy->hdev);
63
64 nfc_mei_phy_free(phy);
65
66 return 0;

--- 43 unchanged lines hidden ---