driver: その他の変更

include順序とか
This commit is contained in:
nns779
2020-10-15 21:14:42 +09:00
parent 92646a5761
commit 9897e722a2
11 changed files with 49 additions and 75 deletions

View File

@@ -2,7 +2,7 @@
/* /*
* Definitions for I2C communicators (i2c_comm.h) * Definitions for I2C communicators (i2c_comm.h)
* *
* Copyright (c) 2018-2019 nns779 * Copyright (c) 2018-2020 nns779
*/ */
#ifndef __I2C_COMM_H__ #ifndef __I2C_COMM_H__

View File

@@ -2,26 +2,20 @@
/* /*
* ITE IT930x driver (it930x.c) * ITE IT930x driver (it930x.c)
* *
* Copyright (c) 2018-2019 nns779 * Copyright (c) 2018-2020 nns779
*/ */
#include "print_format.h" #include "print_format.h"
#include "it930x.h"
#if defined(_WIN32) || defined(_WIN64) #ifdef __linux__
#include "misc_win.h"
#else
#include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/device.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#endif #endif
#include "it930x.h"
#include "itedtv_bus.h"
struct it930x_i2c_master_info { struct it930x_i2c_master_info {
struct it930x_bridge *it930x; struct it930x_bridge *it930x;
u8 bus; u8 bus;
@@ -451,7 +445,7 @@ static int it930x_config_stream_input(struct it930x_bridge *it930x)
} }
/* aggregation mode: sync byte */ /* aggregation mode: sync byte */
ret = it930x_write_reg(it930x, ret = it930x_write_reg(it930x,
0xda73 + input->port_number, 1); 0xda73 + input->port_number, 1);
if (ret) if (ret)
break; break;

View File

@@ -2,17 +2,17 @@
/* /*
* ITE IT930x driver definitions (it930x.h) * ITE IT930x driver definitions (it930x.h)
* *
* Copyright (c) 2018-2019 nns779 * Copyright (c) 2018-2020 nns779
*/ */
#ifndef __IT930X_H__ #ifndef __IT930X_H__
#define __IT930X_H__ #define __IT930X_H__
#if defined(_WIN32) || defined(_WIN64) #ifdef __linux__
#include "misc_win.h"
#else
#include <linux/types.h> #include <linux/types.h>
#include <linux/device.h> #include <linux/device.h>
#elif defined(_WIN32) || defined(_WIN64)
#include "misc_win.h"
#endif #endif
#include "itedtv_bus.h" #include "itedtv_bus.h"

View File

@@ -2,26 +2,20 @@
/* /*
* ITE IT930x bus driver (itedtv_bus.c) * ITE IT930x bus driver (itedtv_bus.c)
* *
* Copyright (c) 2018-2019 nns779 * Copyright (c) 2018-2020 nns779
*/ */
#include "print_format.h" #include "print_format.h"
#include "itedtv_bus.h"
#if defined(_WIN32) || defined(_WIN64) #ifdef __linux__
#include "misc_win.h"
#include "winusb_compat.h"
#else
#include <linux/version.h> #include <linux/version.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/atomic.h> #include <linux/atomic.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/device.h>
#include <linux/usb.h>
#endif #endif
#include "itedtv_bus.h"
#if defined(ITEDTV_BUS_USE_WORKQUEUE) && !defined(__linux__) #if defined(ITEDTV_BUS_USE_WORKQUEUE) && !defined(__linux__)
#undef ITEDTV_BUS_USE_WORKQUEUE #undef ITEDTV_BUS_USE_WORKQUEUE
#endif #endif
@@ -125,6 +119,8 @@ static void itedtv_usb_workqueue_handler(struct work_struct *work)
dev_err(ctx->bus->dev, dev_err(ctx->bus->dev,
"itedtv_usb_workqueue_handler: usb_submit_urb() failed. (ret: %d)\n", "itedtv_usb_workqueue_handler: usb_submit_urb() failed. (ret: %d)\n",
ret); ret);
return;
} }
#endif #endif
@@ -149,7 +145,7 @@ static void itedtv_usb_complete(struct urb *urb)
dev_dbg(ctx->bus->dev, dev_dbg(ctx->bus->dev,
"itedtv_usb_complete: !urb->actual_length\n"); "itedtv_usb_complete: !urb->actual_length\n");
if (!ret && (atomic_read(&ctx->streaming) == 1)) { if (!ret && (atomic_read_acquire(&ctx->streaming) == 1)) {
#ifdef ITEDTV_BUS_USE_WORKQUEUE #ifdef ITEDTV_BUS_USE_WORKQUEUE
ret = queue_work(ctx->wq, &w->work); ret = queue_work(ctx->wq, &w->work);
if (ret) if (ret)
@@ -395,6 +391,8 @@ static void itedtv_usb_clean_context(struct itedtv_usb_context *ctx)
#endif #endif
ctx->num_works = 0; ctx->num_works = 0;
ctx->works = NULL; ctx->works = NULL;
return;
} }
static int itedtv_usb_start_streaming(struct itedtv_bus *bus, static int itedtv_usb_start_streaming(struct itedtv_bus *bus,
@@ -452,7 +450,7 @@ static int itedtv_usb_start_streaming(struct itedtv_bus *bus,
#endif #endif
usb_reset_endpoint(bus->usb.dev, 0x84); usb_reset_endpoint(bus->usb.dev, 0x84);
atomic_set(&ctx->streaming, 1); atomic_xchg(&ctx->streaming, 1);
num = ctx->num_urb; num = ctx->num_urb;
works = ctx->works; works = ctx->works;
@@ -483,7 +481,7 @@ static int itedtv_usb_start_streaming(struct itedtv_bus *bus,
return ret; return ret;
fail: fail:
atomic_set(&ctx->streaming, 0); atomic_xchg(&ctx->streaming, 0);
#ifdef ITEDTV_BUS_USE_WORKQUEUE #ifdef ITEDTV_BUS_USE_WORKQUEUE
if (ctx->wq) if (ctx->wq)
@@ -506,7 +504,7 @@ static int itedtv_usb_stop_streaming(struct itedtv_bus *bus)
mutex_lock(&ctx->lock); mutex_lock(&ctx->lock);
atomic_set(&ctx->streaming, 0); atomic_xchg(&ctx->streaming, 0);
#ifdef ITEDTV_BUS_USE_WORKQUEUE #ifdef ITEDTV_BUS_USE_WORKQUEUE
if (ctx->wq) if (ctx->wq)
@@ -608,7 +606,9 @@ int itedtv_bus_term(struct itedtv_bus *bus)
struct itedtv_usb_context *ctx = bus->usb.priv; struct itedtv_usb_context *ctx = bus->usb.priv;
if (ctx) { if (ctx) {
itedtv_usb_stop_streaming(bus); if (atomic_read_acquire(&ctx->streaming))
itedtv_usb_stop_streaming(bus);
mutex_destroy(&ctx->lock); mutex_destroy(&ctx->lock);
kfree(ctx); kfree(ctx);
} }

View File

@@ -2,18 +2,18 @@
/* /*
* ITE IT930x bus driver definitions (itedtv_bus.h) * ITE IT930x bus driver definitions (itedtv_bus.h)
* *
* Copyright (c) 2018-2019 nns779 * Copyright (c) 2018-2020 nns779
*/ */
#ifndef __ITEDTV_BUS_H__ #ifndef __ITEDTV_BUS_H__
#define __ITEDTV_BUS_H__ #define __ITEDTV_BUS_H__
#if defined(_WIN32) || defined(_WIN64) #ifdef __linux__
#include "misc_win.h"
#include "winusb_compat.h"
#else
#include <linux/device.h> #include <linux/device.h>
#include <linux/usb.h> #include <linux/usb.h>
#elif defined(_WIN32) || defined(_WIN64)
#include "misc_win.h"
#include "winusb_compat.h"
#endif #endif
enum itedtv_bus_type { enum itedtv_bus_type {

View File

@@ -2,27 +2,21 @@
/* /*
* RafaelMicro R850 driver (r850.c) * RafaelMicro R850 driver (r850.c)
* *
* Copyright (c) 2018-2019 nns779 * Copyright (c) 2018-2020 nns779
*/ */
// Some features are not implemented. // Some features are not implemented.
#include "print_format.h" #include "print_format.h"
#include "r850.h"
#if defined(_WIN32) || defined(_WIN64) #ifdef __linux__
#include "misc_win.h"
#else
#include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/mutex.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/device.h>
#endif #endif
#include "r850.h"
enum r850_imr_direction { enum r850_imr_direction {
R850_IMR_DIRECTION_GAIN = 0, R850_IMR_DIRECTION_GAIN = 0,
R850_IMR_DIRECTION_PHASE = 1, R850_IMR_DIRECTION_PHASE = 1,

View File

@@ -2,18 +2,18 @@
/* /*
* RafaelMicro R850 driver definitions (r850.h) * RafaelMicro R850 driver definitions (r850.h)
* *
* Copyright (c) 2018-2019 nns779 * Copyright (c) 2018-2020 nns779
*/ */
#ifndef __R850_H__ #ifndef __R850_H__
#define __R850_H__ #define __R850_H__
#if defined(_WIN32) || defined(_WIN64) #ifdef __linux__
#include "misc_win.h"
#else
#include <linux/types.h> #include <linux/types.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/device.h> #include <linux/device.h>
#elif defined(_WIN32) || defined(_WIN64)
#include "misc_win.h"
#endif #endif
#include "i2c_comm.h" #include "i2c_comm.h"

View File

@@ -2,26 +2,19 @@
/* /*
* RafaelMicro RT710 driver (rt710.c) * RafaelMicro RT710 driver (rt710.c)
* *
* Copyright (c) 2018-2019 nns779 * Copyright (c) 2018-2020 nns779
*/ */
#include "print_format.h" #include "print_format.h"
#include "rt710.h"
#if defined(_WIN32) || defined(_WIN64) #ifdef __linux__
#include "misc_win.h"
#else
#include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/mutex.h>
#include <linux/device.h>
#endif #endif
#include "i2c_comm.h"
#include "rt710.h"
#define NUM_REGS 0x10 #define NUM_REGS 0x10
struct rt710_bandwidth_param { struct rt710_bandwidth_param {

View File

@@ -2,18 +2,18 @@
/* /*
* RafaelMicro RT710 driver definitions (rt710.h) * RafaelMicro RT710 driver definitions (rt710.h)
* *
* Copyright (c) 2018-2019 nns779 * Copyright (c) 2018-2020 nns779
*/ */
#ifndef __RT710_H__ #ifndef __RT710_H__
#define __RT710_H__ #define __RT710_H__
#if defined(_WIN32) || defined(_WIN64) #ifdef __linux__
#include "misc_win.h"
#else
#include <linux/types.h> #include <linux/types.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/device.h> #include <linux/device.h>
#elif defined(_WIN32) || defined(_WIN64)
#include "misc_win.h"
#endif #endif
#include "i2c_comm.h" #include "i2c_comm.h"

View File

@@ -2,26 +2,19 @@
/* /*
* Toshiba TC90522 driver (tc90522.c) * Toshiba TC90522 driver (tc90522.c)
* *
* Copyright (c) 2018-2019 nns779 * Copyright (c) 2018-2020 nns779
*/ */
#include "print_format.h" #include "print_format.h"
#include "tc90522.h"
#if defined(_WIN32) || defined(_WIN64) #ifdef __linux__
#include "misc_win.h"
#else
#include <linux/types.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/mutex.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/device.h>
#endif #endif
#include "i2c_comm.h"
#include "tc90522.h"
static int _tc90522_read_regs(struct tc90522_demod *demod, static int _tc90522_read_regs(struct tc90522_demod *demod,
u8 reg, u8 reg,
u8 *buf, u8 len) u8 *buf, u8 len)

View File

@@ -2,18 +2,18 @@
/* /*
* Toshiba TC90522 driver definitions (tc90522.c) * Toshiba TC90522 driver definitions (tc90522.c)
* *
* Copyright (c) 2018-2019 nns779 * Copyright (c) 2018-2020 nns779
*/ */
#ifndef __TC90522_H__ #ifndef __TC90522_H__
#define __TC90522_H__ #define __TC90522_H__
#if defined(_WIN32) || defined(_WIN64) #ifdef __linux__
#include "misc_win.h"
#else
#include <linux/types.h> #include <linux/types.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/device.h> #include <linux/device.h>
#elif defined(_WIN32) || defined(_WIN64)
#include "misc_win.h"
#endif #endif
#include "i2c_comm.h" #include "i2c_comm.h"