include: net: phy: fix style issue using clang-format

Fix the style formatting of phy.h using clang-format utility.

Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
This commit is contained in:
Parthiban Veerasooran 2024-11-12 16:42:04 +05:30 committed by Benjamin Cabé
parent 8cdc8ec8fd
commit 8eaf558a59

View file

@ -31,21 +31,21 @@ extern "C" {
/** @brief Ethernet link speeds. */
enum phy_link_speed {
/** 10Base-T Half-Duplex */
LINK_HALF_10BASE_T = BIT(0),
LINK_HALF_10BASE_T = BIT(0),
/** 10Base-T Full-Duplex */
LINK_FULL_10BASE_T = BIT(1),
LINK_FULL_10BASE_T = BIT(1),
/** 100Base-T Half-Duplex */
LINK_HALF_100BASE_T = BIT(2),
LINK_HALF_100BASE_T = BIT(2),
/** 100Base-T Full-Duplex */
LINK_FULL_100BASE_T = BIT(3),
LINK_FULL_100BASE_T = BIT(3),
/** 1000Base-T Half-Duplex */
LINK_HALF_1000BASE_T = BIT(4),
LINK_HALF_1000BASE_T = BIT(4),
/** 1000Base-T Full-Duplex */
LINK_FULL_1000BASE_T = BIT(5),
LINK_FULL_1000BASE_T = BIT(5),
/** 2.5GBase-T Full-Duplex */
LINK_FULL_2500BASE_T = BIT(6),
LINK_FULL_2500BASE_T = BIT(6),
/** 5GBase-T Full-Duplex */
LINK_FULL_5000BASE_T = BIT(7),
LINK_FULL_5000BASE_T = BIT(7),
};
/**
@ -55,7 +55,7 @@ enum phy_link_speed {
*
* @return True if link is full duplex, false if not.
*/
#define PHY_LINK_IS_FULL_DUPLEX(x) (x & (BIT(1) | BIT(3) | BIT(5) | BIT(6) | BIT(7)))
#define PHY_LINK_IS_FULL_DUPLEX(x) (x & (BIT(1) | BIT(3) | BIT(5) | BIT(6) | BIT(7)))
/**
* @brief Check if phy link speed is 1 Gbit/sec.
@ -64,7 +64,7 @@ enum phy_link_speed {
*
* @return True if link is 1 Gbit/sec, false if not.
*/
#define PHY_LINK_IS_SPEED_1000M(x) (x & (BIT(4) | BIT(5)))
#define PHY_LINK_IS_SPEED_1000M(x) (x & (BIT(4) | BIT(5)))
/**
* @brief Check if phy link speed is 100 Mbit/sec.
@ -73,7 +73,7 @@ enum phy_link_speed {
*
* @return True if link is 1 Mbit/sec, false if not.
*/
#define PHY_LINK_IS_SPEED_100M(x) (x & (BIT(2) | BIT(3)))
#define PHY_LINK_IS_SPEED_100M(x) (x & (BIT(2) | BIT(3)))
/** @brief Link state */
struct phy_link_state {
@ -92,8 +92,7 @@ struct phy_link_state {
* @param state Pointer to link_state structure.
* @param user_data Pointer to data specified by user
*/
typedef void (*phy_callback_t)(const struct device *dev,
struct phy_link_state *state,
typedef void (*phy_callback_t)(const struct device *dev, struct phy_link_state *state,
void *user_data);
/**
@ -104,24 +103,19 @@ typedef void (*phy_callback_t)(const struct device *dev,
*/
__subsystem struct ethphy_driver_api {
/** Get link state */
int (*get_link)(const struct device *dev,
struct phy_link_state *state);
int (*get_link)(const struct device *dev, struct phy_link_state *state);
/** Configure link */
int (*cfg_link)(const struct device *dev,
enum phy_link_speed adv_speeds);
int (*cfg_link)(const struct device *dev, enum phy_link_speed adv_speeds);
/** Set callback to be invoked when link state changes. */
int (*link_cb_set)(const struct device *dev, phy_callback_t cb,
void *user_data);
int (*link_cb_set)(const struct device *dev, phy_callback_t cb, void *user_data);
/** Read PHY register */
int (*read)(const struct device *dev, uint16_t reg_addr,
uint32_t *data);
int (*read)(const struct device *dev, uint16_t reg_addr, uint32_t *data);
/** Write PHY register */
int (*write)(const struct device *dev, uint16_t reg_addr,
uint32_t data);
int (*write)(const struct device *dev, uint16_t reg_addr, uint32_t data);
};
/**
* @endcond
@ -139,11 +133,9 @@ __subsystem struct ethphy_driver_api {
* @retval -EIO If communication with PHY failed.
* @retval -ENOTSUP If not supported.
*/
static inline int phy_configure_link(const struct device *dev,
enum phy_link_speed speeds)
static inline int phy_configure_link(const struct device *dev, enum phy_link_speed speeds)
{
const struct ethphy_driver_api *api =
(const struct ethphy_driver_api *)dev->api;
const struct ethphy_driver_api *api = (const struct ethphy_driver_api *)dev->api;
return api->cfg_link(dev, speeds);
}
@ -161,11 +153,9 @@ static inline int phy_configure_link(const struct device *dev,
* @retval 0 If successful.
* @retval -EIO If communication with PHY failed.
*/
static inline int phy_get_link_state(const struct device *dev,
struct phy_link_state *state)
static inline int phy_get_link_state(const struct device *dev, struct phy_link_state *state)
{
const struct ethphy_driver_api *api =
(const struct ethphy_driver_api *)dev->api;
const struct ethphy_driver_api *api = (const struct ethphy_driver_api *)dev->api;
return api->get_link(dev, state);
}
@ -184,12 +174,10 @@ static inline int phy_get_link_state(const struct device *dev,
* @retval 0 If successful.
* @retval -ENOTSUP If not supported.
*/
static inline int phy_link_callback_set(const struct device *dev,
phy_callback_t callback,
static inline int phy_link_callback_set(const struct device *dev, phy_callback_t callback,
void *user_data)
{
const struct ethphy_driver_api *api =
(const struct ethphy_driver_api *)dev->api;
const struct ethphy_driver_api *api = (const struct ethphy_driver_api *)dev->api;
return api->link_cb_set(dev, callback, user_data);
}
@ -206,11 +194,9 @@ static inline int phy_link_callback_set(const struct device *dev,
* @retval 0 If successful.
* @retval -EIO If communication with PHY failed.
*/
static inline int phy_read(const struct device *dev, uint16_t reg_addr,
uint32_t *value)
static inline int phy_read(const struct device *dev, uint16_t reg_addr, uint32_t *value)
{
const struct ethphy_driver_api *api =
(const struct ethphy_driver_api *)dev->api;
const struct ethphy_driver_api *api = (const struct ethphy_driver_api *)dev->api;
return api->read(dev, reg_addr, value);
}
@ -227,16 +213,13 @@ static inline int phy_read(const struct device *dev, uint16_t reg_addr,
* @retval 0 If successful.
* @retval -EIO If communication with PHY failed.
*/
static inline int phy_write(const struct device *dev, uint16_t reg_addr,
uint32_t value)
static inline int phy_write(const struct device *dev, uint16_t reg_addr, uint32_t value)
{
const struct ethphy_driver_api *api =
(const struct ethphy_driver_api *)dev->api;
const struct ethphy_driver_api *api = (const struct ethphy_driver_api *)dev->api;
return api->write(dev, reg_addr, value);
}
#ifdef __cplusplus
}
#endif