* [PATCH net-next 0/3] adjust the code of r8152 @ 2014-01-06 6:39 Hayes Wang 2014-01-06 6:39 ` [PATCH net-next 1/3] r8152: replace some tabs with spaces Hayes Wang ` (3 more replies) 0 siblings, 4 replies; 10+ messages in thread From: Hayes Wang @ 2014-01-06 6:39 UTC (permalink / raw) To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang Replace some tabs and modify the return value of rtl_ops_init(). Hayes Wang (3): r8152: replace some tabs with spaces r8152: move the actions of saving the information of the device r8152: replace the return value of rtl_ops_init drivers/net/usb/r8152.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) -- 1.8.4.2 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net-next 1/3] r8152: replace some tabs with spaces 2014-01-06 6:39 [PATCH net-next 0/3] adjust the code of r8152 Hayes Wang @ 2014-01-06 6:39 ` Hayes Wang 2014-01-06 6:39 ` [PATCH net-next 2/3] r8152: move the actions of saving the information of the device Hayes Wang ` (2 subsequent siblings) 3 siblings, 0 replies; 10+ messages in thread From: Hayes Wang @ 2014-01-06 6:39 UTC (permalink / raw) To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang Replace the tabs of the variables declaration with the spaces. Signed-off-by: Hayes Wang <hayeswang@realtek.com> --- drivers/net/usb/r8152.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 13fabbb..095f15b 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -584,8 +584,8 @@ int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) static int generic_ocp_read(struct r8152 *tp, u16 index, u16 size, void *data, u16 type) { - u16 limit = 64; - int ret = 0; + u16 limit = 64; + int ret = 0; if (test_bit(RTL8152_UNPLUG, &tp->flags)) return -ENODEV; @@ -624,9 +624,9 @@ static int generic_ocp_read(struct r8152 *tp, u16 index, u16 size, static int generic_ocp_write(struct r8152 *tp, u16 index, u16 byteen, u16 size, void *data, u16 type) { - int ret; - u16 byteen_start, byteen_end, byen; - u16 limit = 512; + int ret; + u16 byteen_start, byteen_end, byen; + u16 limit = 512; if (test_bit(RTL8152_UNPLUG, &tp->flags)) return -ENODEV; @@ -1812,8 +1812,8 @@ static void r8152b_exit_oob(struct r8152 *tp) static void r8152b_enter_oob(struct r8152 *tp) { - u32 ocp_data; - int i; + u32 ocp_data; + int i; ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data &= ~NOW_IS_OOB; @@ -2340,7 +2340,7 @@ static void r8153_clear_bp(struct r8152 *tp) static void r8152b_enable_eee(struct r8152 *tp) { - u32 ocp_data; + u32 ocp_data; ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEE_CR); ocp_data |= EEE_RX_EN | EEE_TX_EN; -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next 2/3] r8152: move the actions of saving the information of the device 2014-01-06 6:39 [PATCH net-next 0/3] adjust the code of r8152 Hayes Wang 2014-01-06 6:39 ` [PATCH net-next 1/3] r8152: replace some tabs with spaces Hayes Wang @ 2014-01-06 6:39 ` Hayes Wang [not found] ` <1388990366-8508-1-git-send-email-hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org> 2014-01-06 9:08 ` [PATCH net-next v2 0/3] adjust the code of r8152 Hayes Wang 3 siblings, 0 replies; 10+ messages in thread From: Hayes Wang @ 2014-01-06 6:39 UTC (permalink / raw) To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang Some information of the device may be used in other functions. Move the relative code to make sure it would be initialzed correctly before using it. Signed-off-by: Hayes Wang <hayeswang@realtek.com> --- drivers/net/usb/r8152.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 095f15b..8615681 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2759,6 +2759,10 @@ static int rtl8152_probe(struct usb_interface *intf, tp = netdev_priv(netdev); tp->msg_enable = 0x7FFF; + tp->udev = udev; + tp->netdev = netdev; + tp->intf = intf; + if (!rtl_ops_init(tp, id)) { netif_err(tp, probe, netdev, "Unknown Device"); return -ENODEV; @@ -2767,9 +2771,6 @@ static int rtl8152_probe(struct usb_interface *intf, tasklet_init(&tp->tl, bottom_half, (unsigned long)tp); INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t); - tp->udev = udev; - tp->netdev = netdev; - tp->intf = intf; netdev->netdev_ops = &rtl8152_netdev_ops; netdev->watchdog_timeo = RTL8152_TX_TIMEOUT; -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
[parent not found: <1388990366-8508-1-git-send-email-hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>]
* [PATCH net-next 3/3] r8152: replace the return value of rtl_ops_init [not found] ` <1388990366-8508-1-git-send-email-hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org> @ 2014-01-06 6:39 ` Hayes Wang 2014-01-06 6:59 ` Joe Perches 0 siblings, 1 reply; 10+ messages in thread From: Hayes Wang @ 2014-01-06 6:39 UTC (permalink / raw) To: netdev-u79uwXL29TY76Z2rM5mHXA Cc: nic_swsd-Rasf1IRRPZFBDgjK7y7TUQ, linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-usb-u79uwXL29TY76Z2rM5mHXA, Hayes Wang Replace the boolean value with the error code for the return value of the rtl_ops_init(). Signed-off-by: Hayes Wang <hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org> --- drivers/net/usb/r8152.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 8615681..06ed043 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2685,10 +2685,10 @@ static void rtl8153_unload(struct r8152 *tp) r8153_power_cut_en(tp, 1); } -static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) +static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) { struct rtl_ops *ops = &tp->rtl_ops; - bool ret = true; + int ret = -ENODEV; switch (id->idVendor) { case VENDOR_ID_REALTEK: @@ -2699,6 +2699,7 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) ops->disable = rtl8152_disable; ops->down = rtl8152_down; ops->unload = rtl8152_unload; + ret = 0; break; case PRODUCT_ID_RTL8153: ops->init = r8153_init; @@ -2706,9 +2707,9 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) ops->disable = rtl8152_disable; ops->down = rtl8153_down; ops->unload = rtl8153_unload; + ret = 0; break; default: - ret = false; break; } break; @@ -2721,18 +2722,20 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) ops->disable = rtl8152_disable; ops->down = rtl8153_down; ops->unload = rtl8153_unload; + ret = 0; break; default: - ret = false; break; } break; default: - ret = false; break; } + if (ret) + netif_err(tp, probe, tp->netdev, "Unknown Device"); + return ret; } @@ -2763,10 +2766,9 @@ static int rtl8152_probe(struct usb_interface *intf, tp->netdev = netdev; tp->intf = intf; - if (!rtl_ops_init(tp, id)) { - netif_err(tp, probe, netdev, "Unknown Device"); - return -ENODEV; - } + ret = rtl_ops_init(tp, id); + if (ret) + goto out; tasklet_init(&tp->tl, bottom_half, (unsigned long)tp); INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t); -- 1.8.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH net-next 3/3] r8152: replace the return value of rtl_ops_init 2014-01-06 6:39 ` [PATCH net-next 3/3] r8152: replace the return value of rtl_ops_init Hayes Wang @ 2014-01-06 6:59 ` Joe Perches 0 siblings, 0 replies; 10+ messages in thread From: Joe Perches @ 2014-01-06 6:59 UTC (permalink / raw) To: Hayes Wang; +Cc: netdev, nic_swsd, linux-kernel, linux-usb > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c [] > @@ -2721,18 +2722,20 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) [] > + if (ret) > + netif_err(tp, probe, tp->netdev, "Unknown Device"); This format should have a terminating newline "Unknown Device\n" ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net-next v2 0/3] adjust the code of r8152 2014-01-06 6:39 [PATCH net-next 0/3] adjust the code of r8152 Hayes Wang ` (2 preceding siblings ...) [not found] ` <1388990366-8508-1-git-send-email-hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org> @ 2014-01-06 9:08 ` Hayes Wang 2014-01-06 9:08 ` [PATCH net-next v2 1/3] r8152: replace some tabs with spaces Hayes Wang ` (3 more replies) 3 siblings, 4 replies; 10+ messages in thread From: Hayes Wang @ 2014-01-06 9:08 UTC (permalink / raw) To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang Replace some tabs and modify the return value of rtl_ops_init(). v2: add the terminating newline for the message of patch #3. Hayes Wang (3): r8152: replace some tabs with spaces r8152: move the actions of saving the information of the device r8152: replace the return value of rtl_ops_init drivers/net/usb/r8152.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) -- 1.8.4.2 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH net-next v2 1/3] r8152: replace some tabs with spaces 2014-01-06 9:08 ` [PATCH net-next v2 0/3] adjust the code of r8152 Hayes Wang @ 2014-01-06 9:08 ` Hayes Wang 2014-01-06 9:08 ` [PATCH net-next v2 2/3] r8152: move the actions of saving the information of the device Hayes Wang ` (2 subsequent siblings) 3 siblings, 0 replies; 10+ messages in thread From: Hayes Wang @ 2014-01-06 9:08 UTC (permalink / raw) To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang Replace the tabs of the variables declaration with the spaces. Signed-off-by: Hayes Wang <hayeswang@realtek.com> --- drivers/net/usb/r8152.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 13fabbb..095f15b 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -584,8 +584,8 @@ int set_registers(struct r8152 *tp, u16 value, u16 index, u16 size, void *data) static int generic_ocp_read(struct r8152 *tp, u16 index, u16 size, void *data, u16 type) { - u16 limit = 64; - int ret = 0; + u16 limit = 64; + int ret = 0; if (test_bit(RTL8152_UNPLUG, &tp->flags)) return -ENODEV; @@ -624,9 +624,9 @@ static int generic_ocp_read(struct r8152 *tp, u16 index, u16 size, static int generic_ocp_write(struct r8152 *tp, u16 index, u16 byteen, u16 size, void *data, u16 type) { - int ret; - u16 byteen_start, byteen_end, byen; - u16 limit = 512; + int ret; + u16 byteen_start, byteen_end, byen; + u16 limit = 512; if (test_bit(RTL8152_UNPLUG, &tp->flags)) return -ENODEV; @@ -1812,8 +1812,8 @@ static void r8152b_exit_oob(struct r8152 *tp) static void r8152b_enter_oob(struct r8152 *tp) { - u32 ocp_data; - int i; + u32 ocp_data; + int i; ocp_data = ocp_read_byte(tp, MCU_TYPE_PLA, PLA_OOB_CTRL); ocp_data &= ~NOW_IS_OOB; @@ -2340,7 +2340,7 @@ static void r8153_clear_bp(struct r8152 *tp) static void r8152b_enable_eee(struct r8152 *tp) { - u32 ocp_data; + u32 ocp_data; ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEE_CR); ocp_data |= EEE_RX_EN | EEE_TX_EN; -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next v2 2/3] r8152: move the actions of saving the information of the device 2014-01-06 9:08 ` [PATCH net-next v2 0/3] adjust the code of r8152 Hayes Wang 2014-01-06 9:08 ` [PATCH net-next v2 1/3] r8152: replace some tabs with spaces Hayes Wang @ 2014-01-06 9:08 ` Hayes Wang 2014-01-06 9:08 ` [PATCH net-next v2 3/3] r8152: replace the return value of rtl_ops_init Hayes Wang 2014-01-06 21:15 ` [PATCH net-next v2 0/3] adjust the code of r8152 David Miller 3 siblings, 0 replies; 10+ messages in thread From: Hayes Wang @ 2014-01-06 9:08 UTC (permalink / raw) To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang Some information of the device may be used in other functions. Move the relative code to make sure it would be initialzed correctly before using it. Signed-off-by: Hayes Wang <hayeswang@realtek.com> --- drivers/net/usb/r8152.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 095f15b..8615681 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2759,6 +2759,10 @@ static int rtl8152_probe(struct usb_interface *intf, tp = netdev_priv(netdev); tp->msg_enable = 0x7FFF; + tp->udev = udev; + tp->netdev = netdev; + tp->intf = intf; + if (!rtl_ops_init(tp, id)) { netif_err(tp, probe, netdev, "Unknown Device"); return -ENODEV; @@ -2767,9 +2771,6 @@ static int rtl8152_probe(struct usb_interface *intf, tasklet_init(&tp->tl, bottom_half, (unsigned long)tp); INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t); - tp->udev = udev; - tp->netdev = netdev; - tp->intf = intf; netdev->netdev_ops = &rtl8152_netdev_ops; netdev->watchdog_timeo = RTL8152_TX_TIMEOUT; -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net-next v2 3/3] r8152: replace the return value of rtl_ops_init 2014-01-06 9:08 ` [PATCH net-next v2 0/3] adjust the code of r8152 Hayes Wang 2014-01-06 9:08 ` [PATCH net-next v2 1/3] r8152: replace some tabs with spaces Hayes Wang 2014-01-06 9:08 ` [PATCH net-next v2 2/3] r8152: move the actions of saving the information of the device Hayes Wang @ 2014-01-06 9:08 ` Hayes Wang 2014-01-06 21:15 ` [PATCH net-next v2 0/3] adjust the code of r8152 David Miller 3 siblings, 0 replies; 10+ messages in thread From: Hayes Wang @ 2014-01-06 9:08 UTC (permalink / raw) To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang Replace the boolean value with the error code for the return value of the rtl_ops_init(). Signed-off-by: Hayes Wang <hayeswang@realtek.com> --- drivers/net/usb/r8152.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index 8615681..881475f 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -2685,10 +2685,10 @@ static void rtl8153_unload(struct r8152 *tp) r8153_power_cut_en(tp, 1); } -static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) +static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) { struct rtl_ops *ops = &tp->rtl_ops; - bool ret = true; + int ret = -ENODEV; switch (id->idVendor) { case VENDOR_ID_REALTEK: @@ -2699,6 +2699,7 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) ops->disable = rtl8152_disable; ops->down = rtl8152_down; ops->unload = rtl8152_unload; + ret = 0; break; case PRODUCT_ID_RTL8153: ops->init = r8153_init; @@ -2706,9 +2707,9 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) ops->disable = rtl8152_disable; ops->down = rtl8153_down; ops->unload = rtl8153_unload; + ret = 0; break; default: - ret = false; break; } break; @@ -2721,18 +2722,20 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) ops->disable = rtl8152_disable; ops->down = rtl8153_down; ops->unload = rtl8153_unload; + ret = 0; break; default: - ret = false; break; } break; default: - ret = false; break; } + if (ret) + netif_err(tp, probe, tp->netdev, "Unknown Device\n"); + return ret; } @@ -2763,10 +2766,9 @@ static int rtl8152_probe(struct usb_interface *intf, tp->netdev = netdev; tp->intf = intf; - if (!rtl_ops_init(tp, id)) { - netif_err(tp, probe, netdev, "Unknown Device"); - return -ENODEV; - } + ret = rtl_ops_init(tp, id); + if (ret) + goto out; tasklet_init(&tp->tl, bottom_half, (unsigned long)tp); INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t); -- 1.8.4.2 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH net-next v2 0/3] adjust the code of r8152 2014-01-06 9:08 ` [PATCH net-next v2 0/3] adjust the code of r8152 Hayes Wang ` (2 preceding siblings ...) 2014-01-06 9:08 ` [PATCH net-next v2 3/3] r8152: replace the return value of rtl_ops_init Hayes Wang @ 2014-01-06 21:15 ` David Miller 3 siblings, 0 replies; 10+ messages in thread From: David Miller @ 2014-01-06 21:15 UTC (permalink / raw) To: hayeswang; +Cc: netdev, nic_swsd, linux-kernel, linux-usb From: Hayes Wang <hayeswang@realtek.com> Date: Mon, 6 Jan 2014 17:08:40 +0800 > Replace some tabs and modify the return value of rtl_ops_init(). > > v2: add the terminating newline for the message of patch #3. Series applied. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2014-01-06 21:15 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-01-06 6:39 [PATCH net-next 0/3] adjust the code of r8152 Hayes Wang 2014-01-06 6:39 ` [PATCH net-next 1/3] r8152: replace some tabs with spaces Hayes Wang 2014-01-06 6:39 ` [PATCH net-next 2/3] r8152: move the actions of saving the information of the device Hayes Wang [not found] ` <1388990366-8508-1-git-send-email-hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org> 2014-01-06 6:39 ` [PATCH net-next 3/3] r8152: replace the return value of rtl_ops_init Hayes Wang 2014-01-06 6:59 ` Joe Perches 2014-01-06 9:08 ` [PATCH net-next v2 0/3] adjust the code of r8152 Hayes Wang 2014-01-06 9:08 ` [PATCH net-next v2 1/3] r8152: replace some tabs with spaces Hayes Wang 2014-01-06 9:08 ` [PATCH net-next v2 2/3] r8152: move the actions of saving the information of the device Hayes Wang 2014-01-06 9:08 ` [PATCH net-next v2 3/3] r8152: replace the return value of rtl_ops_init Hayes Wang 2014-01-06 21:15 ` [PATCH net-next v2 0/3] adjust the code of r8152 David Miller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).