Commit 0e2adc06 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Greg Kroah-Hartman

serial/pch: use global div helper instead of creating a private one

Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: default avatarAlan Cox  <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b9b24558
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
*along with this program; if not, write to the Free Software *along with this program; if not, write to the Free Software
*Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. *Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include <linux/kernel.h>
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -137,8 +138,6 @@ enum { ...@@ -137,8 +138,6 @@ enum {
#define PCH_UART_DLL 0x00 #define PCH_UART_DLL 0x00
#define PCH_UART_DLM 0x01 #define PCH_UART_DLM 0x01
#define DIV_ROUND(a, b) (((a) + ((b)/2)) / (b))
#define PCH_UART_IID_RLS (PCH_UART_IIR_REI) #define PCH_UART_IID_RLS (PCH_UART_IIR_REI)
#define PCH_UART_IID_RDR (PCH_UART_IIR_RRI) #define PCH_UART_IID_RDR (PCH_UART_IIR_RRI)
#define PCH_UART_IID_RDR_TO (PCH_UART_IIR_RRI | PCH_UART_IIR_TOI) #define PCH_UART_IID_RDR_TO (PCH_UART_IIR_RRI | PCH_UART_IIR_TOI)
...@@ -316,7 +315,7 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud, ...@@ -316,7 +315,7 @@ static int pch_uart_hal_set_line(struct eg20t_port *priv, int baud,
unsigned int dll, dlm, lcr; unsigned int dll, dlm, lcr;
int div; int div;
div = DIV_ROUND(priv->base_baud / 16, baud); div = DIV_ROUND_CLOSEST(priv->base_baud / 16, baud);
if (div < 0 || USHRT_MAX <= div) { if (div < 0 || USHRT_MAX <= div) {
dev_err(priv->port.dev, "Invalid Baud(div=0x%x)\n", div); dev_err(priv->port.dev, "Invalid Baud(div=0x%x)\n", div);
return -EINVAL; return -EINVAL;
......
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