Jacob Keller
2013-08-30 17:57:46 UTC
This patch updates the warning for when the driver changed the requested
tx_type or rx_filter mode. Rather than blindly displaying both, check which
ones changed and display them only if they do.
Signed-off-by: Jacob Keller <***@intel.com>
---
sk.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/sk.c b/sk.c
index a13d14d..39c7742 100644
--- a/sk.c
+++ b/sk.c
@@ -58,17 +58,21 @@ static int hwts_init(int fd, char *device, int rx_filter, int one_step)
if (err < 0)
return err;
- if (memcmp(&cfg, &req, sizeof(cfg))) {
-
- pr_warning("driver changed our HWTSTAMP options");
+ if (cfg.tx_type != req.tx_type) {
+ pr_warning("driver changed our Rx HWTSTAMP options");
pr_warning("tx_type %d not %d", cfg.tx_type, req.tx_type);
+ }
+
+ if (cfg.rx_filter != req.rx_filter) {
+ pr_warning("driver changed our Tx HWTSTAMP options");
pr_warning("rx_filter %d not %d", cfg.rx_filter, req.rx_filter);
+ }
- if (cfg.tx_type != req.tx_type ||
- (cfg.rx_filter != HWTSTAMP_FILTER_ALL &&
- cfg.rx_filter != HWTSTAMP_FILTER_PTP_V2_EVENT)) {
- return -1;
- }
+ /* Exit only after checking both Tx and Rx types */
+ if (cfg.tx_type != req.tx_type ||
+ (cfg.rx_filter != HWTSTAMP_FILTER_ALL &&
+ cfg.rx_filter != HWTSTAMP_FILTER_PTP_V2_EVENT)) {
+ return -1;
}
return 0;
tx_type or rx_filter mode. Rather than blindly displaying both, check which
ones changed and display them only if they do.
Signed-off-by: Jacob Keller <***@intel.com>
---
sk.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/sk.c b/sk.c
index a13d14d..39c7742 100644
--- a/sk.c
+++ b/sk.c
@@ -58,17 +58,21 @@ static int hwts_init(int fd, char *device, int rx_filter, int one_step)
if (err < 0)
return err;
- if (memcmp(&cfg, &req, sizeof(cfg))) {
-
- pr_warning("driver changed our HWTSTAMP options");
+ if (cfg.tx_type != req.tx_type) {
+ pr_warning("driver changed our Rx HWTSTAMP options");
pr_warning("tx_type %d not %d", cfg.tx_type, req.tx_type);
+ }
+
+ if (cfg.rx_filter != req.rx_filter) {
+ pr_warning("driver changed our Tx HWTSTAMP options");
pr_warning("rx_filter %d not %d", cfg.rx_filter, req.rx_filter);
+ }
- if (cfg.tx_type != req.tx_type ||
- (cfg.rx_filter != HWTSTAMP_FILTER_ALL &&
- cfg.rx_filter != HWTSTAMP_FILTER_PTP_V2_EVENT)) {
- return -1;
- }
+ /* Exit only after checking both Tx and Rx types */
+ if (cfg.tx_type != req.tx_type ||
+ (cfg.rx_filter != HWTSTAMP_FILTER_ALL &&
+ cfg.rx_filter != HWTSTAMP_FILTER_PTP_V2_EVENT)) {
+ return -1;
}
return 0;