mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
treewide: Use L_TFR macro
This commit is contained in:
parent
865492df8c
commit
57748347b0
16
src/rfkill.c
16
src/rfkill.c
@ -38,12 +38,6 @@
|
||||
#include "src/common.h"
|
||||
#include "src/rfkill.h"
|
||||
|
||||
#ifdef TEMP_FAILURE_RETRY
|
||||
#define TFR TEMP_FAILURE_RETRY
|
||||
#else
|
||||
#define TFR
|
||||
#endif
|
||||
|
||||
struct rfkill_map_entry {
|
||||
unsigned int wiphy_id;
|
||||
unsigned int rfkill_id;
|
||||
@ -89,14 +83,14 @@ static struct rfkill_map_entry *map_wiphy(unsigned int rfkill_id)
|
||||
|
||||
path = l_strdup_printf("/sys/class/rfkill/rfkill%u/device/index", rfkill_id);
|
||||
|
||||
fd = TFR(open(path, O_RDONLY));
|
||||
fd = L_TFR(open(path, O_RDONLY));
|
||||
|
||||
l_free(path);
|
||||
|
||||
if (fd < 0)
|
||||
return NULL;
|
||||
|
||||
bytes = TFR(read(fd, buf, sizeof(buf) - 1));
|
||||
bytes = L_TFR(read(fd, buf, sizeof(buf) - 1));
|
||||
|
||||
close(fd);
|
||||
|
||||
@ -131,7 +125,7 @@ static bool rfkill_read(struct l_io *io, void *user_data)
|
||||
int bytes;
|
||||
struct rfkill_map_entry *entry;
|
||||
|
||||
bytes = TFR(read(fd, &e, sizeof(e)));
|
||||
bytes = L_TFR(read(fd, &e, sizeof(e)));
|
||||
if (bytes < (int) sizeof(e)) {
|
||||
if (bytes <= 0)
|
||||
l_error("rfkill read: %s", strerror(errno));
|
||||
@ -208,7 +202,7 @@ bool rfkill_set_soft_state(unsigned int wiphy_id, bool state)
|
||||
e.op = RFKILL_OP_CHANGE;
|
||||
e.soft = state ? 1 : 0;
|
||||
|
||||
bytes = TFR(write(fd, &e, sizeof(e)));
|
||||
bytes = L_TFR(write(fd, &e, sizeof(e)));
|
||||
if (bytes < (int) sizeof(e)) {
|
||||
if (bytes <= 0)
|
||||
l_error("rfkill write: %s", strerror(errno));
|
||||
@ -284,7 +278,7 @@ int rfkill_init(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = TFR(open("/dev/rfkill", O_RDWR | O_CLOEXEC));
|
||||
fd = L_TFR(open("/dev/rfkill", O_RDWR | O_CLOEXEC));
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
|
@ -43,12 +43,6 @@
|
||||
#include "src/common.h"
|
||||
#include "src/storage.h"
|
||||
|
||||
#ifdef TEMP_FAILURE_RETRY
|
||||
#define TFR TEMP_FAILURE_RETRY
|
||||
#else
|
||||
#define TFR
|
||||
#endif
|
||||
|
||||
#define STORAGE_DIR_MODE (S_IRUSR | S_IWUSR | S_IXUSR)
|
||||
#define STORAGE_FILE_MODE (S_IRUSR | S_IWUSR)
|
||||
|
||||
@ -97,16 +91,16 @@ ssize_t read_file(void *buffer, size_t len, const char *path_fmt, ...)
|
||||
path = l_strdup_vprintf(path_fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
fd = TFR(open(path, O_RDONLY));
|
||||
fd = L_TFR(open(path, O_RDONLY));
|
||||
|
||||
l_free(path);
|
||||
|
||||
if (fd == -1)
|
||||
return -1;
|
||||
|
||||
r = TFR(read(fd, buffer, len));
|
||||
r = L_TFR(read(fd, buffer, len));
|
||||
|
||||
TFR(close(fd));
|
||||
L_TFR(close(fd));
|
||||
|
||||
return r;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user