Commit f4a3bc82 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (3159): Replaces MAX()/MIN() by kernel.h max()/min() macros

- Replaces MAX()/MIN() by kernel.h max()/min() macros
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
parent f961e71a
...@@ -166,8 +166,6 @@ struct msp3400c { ...@@ -166,8 +166,6 @@ struct msp3400c {
int watch_stereo:1; int watch_stereo:1;
}; };
#define MIN(a,b) (((a)>(b))?(b):(a))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define HAVE_NICAM(msp) (((msp->rev2>>8) & 0xff) != 00) #define HAVE_NICAM(msp) (((msp->rev2>>8) & 0xff) != 00)
#define HAVE_SIMPLE(msp) ((msp->rev1 & 0xff) >= 'D'-'@') #define HAVE_SIMPLE(msp) ((msp->rev1 & 0xff) >= 'D'-'@')
#define HAVE_SIMPLER(msp) ((msp->rev1 & 0xff) >= 'G'-'@') #define HAVE_SIMPLER(msp) ((msp->rev1 & 0xff) >= 'G'-'@')
...@@ -1670,9 +1668,9 @@ static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) ...@@ -1670,9 +1668,9 @@ static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl)
return 0; return 0;
case V4L2_CID_AUDIO_BALANCE: case V4L2_CID_AUDIO_BALANCE:
{ {
int volume = MAX(msp->left, msp->right); int volume = max(msp->left, msp->right);
ctrl->value = (32768 * MIN(msp->left, msp->right)) / ctrl->value = (32768 * min(msp->left, msp->right)) /
(volume ? volume : 1); (volume ? volume : 1);
ctrl->value = (msp->left < msp->right) ? ctrl->value = (msp->left < msp->right) ?
(65535 - ctrl->value) : ctrl->value; (65535 - ctrl->value) : ctrl->value;
...@@ -1687,7 +1685,7 @@ static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) ...@@ -1687,7 +1685,7 @@ static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl)
ctrl->value = msp->treble; ctrl->value = msp->treble;
return 0; return 0;
case V4L2_CID_AUDIO_VOLUME: case V4L2_CID_AUDIO_VOLUME:
ctrl->value = MAX(msp->left, msp->right); ctrl->value = max(msp->left, msp->right);
return 0; return 0;
default: default:
return -EINVAL; return -EINVAL;
...@@ -1710,7 +1708,7 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) ...@@ -1710,7 +1708,7 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl)
return 0; return 0;
case V4L2_CID_AUDIO_BALANCE: case V4L2_CID_AUDIO_BALANCE:
balance=ctrl->value; balance=ctrl->value;
volume = MAX(msp->left, msp->right); volume = max(msp->left, msp->right);
set_volume=1; set_volume=1;
break; break;
case V4L2_CID_AUDIO_BASS: case V4L2_CID_AUDIO_BASS:
...@@ -1722,9 +1720,9 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) ...@@ -1722,9 +1720,9 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl)
msp3400c_settreble(client, msp->treble); msp3400c_settreble(client, msp->treble);
return 0; return 0;
case V4L2_CID_AUDIO_VOLUME: case V4L2_CID_AUDIO_VOLUME:
volume = MAX(msp->left, msp->right); volume = max(msp->left, msp->right);
balance = (32768 * MIN(msp->left, msp->right)) / balance = (32768 * min(msp->left, msp->right)) /
(volume ? volume : 1); (volume ? volume : 1);
balance = (msp->left < msp->right) ? balance = (msp->left < msp->right) ?
(65535 - balance) : balance; (65535 - balance) : balance;
...@@ -1739,8 +1737,8 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) ...@@ -1739,8 +1737,8 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl)
} }
if (set_volume) { if (set_volume) {
msp->left = (MIN(65536 - balance, 32768) * volume) / 32768; msp->left = (min(65536 - balance, 32768) * volume) / 32768;
msp->right = (MIN(balance, 32768) * volume) / 32768; msp->right = (min(balance, 32768) * volume) / 32768;
msp3400_dbg("volume=%d, balance=%d, left=%d, right=%d", msp3400_dbg("volume=%d, balance=%d, left=%d, right=%d",
volume,balance,msp->left,msp->right); volume,balance,msp->left,msp->right);
...@@ -1861,8 +1859,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -1861,8 +1859,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
if (msp->muted) if (msp->muted)
va->flags |= VIDEO_AUDIO_MUTE; va->flags |= VIDEO_AUDIO_MUTE;
va->volume = MAX(msp->left, msp->right); va->volume = max(msp->left, msp->right);
va->balance = (32768 * MIN(msp->left, msp->right)) / va->balance = (32768 * min(msp->left, msp->right)) /
(va->volume ? va->volume : 1); (va->volume ? va->volume : 1);
va->balance = (msp->left < msp->right) ? va->balance = (msp->left < msp->right) ?
(65535 - va->balance) : va->balance; (65535 - va->balance) : va->balance;
...@@ -1881,9 +1879,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -1881,9 +1879,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
msp3400_dbg("VIDIOCSAUDIO\n"); msp3400_dbg("VIDIOCSAUDIO\n");
msp->muted = (va->flags & VIDEO_AUDIO_MUTE); msp->muted = (va->flags & VIDEO_AUDIO_MUTE);
msp->left = (MIN(65536 - va->balance, 32768) * msp->left = (min(65536 - va->balance, 32768) *
va->volume) / 32768; va->volume) / 32768;
msp->right = (MIN(va->balance, 32768) * va->volume) / 32768; msp->right = (min((int)va->balance, 32768) * va->volume) / 32768;
msp->bass = va->bass; msp->bass = va->bass;
msp->treble = va->treble; msp->treble = va->treble;
msp3400_dbg("VIDIOCSAUDIO setting va->volume to %d\n", msp3400_dbg("VIDIOCSAUDIO setting va->volume to %d\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment